This guide will help you set up automatic publishing from Google Docs to your Jekyll site. Once configured, any document you add to a specific Google Drive folder will automatically be published to your site within an hour.

Prerequisites

Step 1: Create the Watch Folder

  1. Go to Google Drive
  2. Click New ? Folder
  3. Name it “Blog Posts” (or any name you prefer)
  4. Click Create

    Step 2: Get the Folder ID

  5. Open the “Blog Posts” folder
  6. Look at the URL in your browser’s address bar:
  7. Copy the long string after /folders/ - this is your Folder ID
  8. Save it somewhere - you’ll need it in Step 8

    Part 2: Generate GitHub Personal Access Token (5 minutes)

Step 3: Create GitHub Token

  1. Go to GitHub Settings
  2. Click Developer settings (bottom of left sidebar)
  3. Click Personal access tokens ? Tokens (classic)
  4. Click Generate new token ? Generate new token (classic)

    Step 4: Configure Token

  5. Note: Enter “Jekyll Auto-Publisher”
  6. Expiration: Select “No expiration” (or set a custom date)
  7. Select scopes: Check ? repo (this gives full control of private repositories)
    • This will automatically check all sub-options under “repo”
  8. Scroll to bottom and click Generate token

    Step 5: Save Your Token

  9. You’ll see a green box with your token (starts with ghp_)
  10. IMPORTANT: Copy this token immediately - you can only see it once!
  11. Save it in a secure location (password manager, secure note, etc.)
  12. You’ll paste this into the script in Step 8 Security Note: Treat this token like a password. Anyone with this token can access your repository.

Part 3: Install the Automated Script (5 minutes)

Step 6: Create Apps Script Project

  1. Go to Google Apps Script
  2. Click New project (top left)
  3. You’ll see a new project with default code

    Step 7: Add the Script

  4. Delete all existing code in the editor (select all and delete)
  5. Copy the entire automated script I provided above
  6. Paste it into the editor
  7. Click the disk icon (?) or press Ctrl+S to save
  8. At the top, click “Untitled project” and rename it to “Jekyll Auto-Publisher”
  9. Click OK

    Step 8: Configure Your Settings

Find this section at the top of the script and update it with your information:

Replace:

Step 9: Test the Script

Before automating, let’s test that everything works:

  1. In the Apps Script editor, find the function dropdown (near the top)
  2. Select testAutomation from the dropdown
  3. Click the Run button (?? play icon)
  4. First time only: You’ll be asked to authorize:
    • Click Review Permissions
    • Choose your Google account
    • Click Advanced ? Go to Jekyll Auto-Publisher (unsafe)
    • Click Allow
  5. Wait for the script to finish (watch the “Execution log” at bottom)
  6. Check the logs - you should see “Test complete” If you get errors: Check the execution log for details. Common issues:

Step 10: Create Time-Based Trigger

  1. In the Apps Script editor, click the clock icon (?) on the left sidebar
    • This is the “Triggers” section
  2. Click Add Trigger (bottom right)
  3. Configure the trigger:
    • Choose which function to run: checkForNewPosts
    • Choose which deployment should run: Head
    • Select event source: Time-driven
    • Select type of time based trigger: Hour timer
    • Select hour interval: Every hour
  4. Click Save

    Step 11: Confirm Trigger is Active

  5. You should now see your trigger in the list
  6. It will show:
    • Function: checkForNewPosts
    • Event: Time-driven, Every hour
    • Status: Enabled (if there’s a toggle, make sure it’s on) That’s it! Your automation is now running.

Part 5: Using Your Automated System (2 minutes per post)

Publishing a New Post

  1. Create a Google Doc in your “Blog Posts” folder:
    • Go to your “Blog Posts” folder in Google Drive
    • Click New ? Google Docs
    • Give it a meaningful title (this becomes your post title)
  2. Write your post:
    • Use Heading 1, 2, 3 for structure
    • Add bold, italic, links as normal
    • Insert images anywhere in the document
    • Write naturally - no need to think about Markdown
  3. Wait up to 1 hour:
    • The script runs every hour
    • It will detect your new document
    • Convert it to Markdown
    • Push to GitHub
    • Your site rebuilds automatically
  4. Check your site:
    • After GitHub Pages rebuilds (1-2 minutes)
    • Your post should be live!

      Creating a Draft

To work on a post without publishing yet:

  1. Prefix the title with “DRAFT:”
    • Example: “DRAFT: My Upcoming Tutorial”
  2. Write as much as you want
  3. When ready to publish: Remove “DRAFT:” from the title
  4. Within an hour, it will auto-publish

    Updating a Published Post

  5. Edit the Google Doc in your “Blog Posts” folder
  6. Make your changes
  7. Save (Ctrl+S or Cmd+S)
  8. Within an hour, changes will be live on your site

    Deleting a Post

  9. Remove the doc from “Blog Posts” folder
    • Move it to another folder or trash it
  10. Manually delete from GitHub:
    • Go to your repository on GitHub
    • Navigate to _posts/ folder
    • Find the post file
    • Click it ? Click trash icon ? Commit deletion Note: Automated deletion is intentionally not included to prevent accidental data loss.

Part 6: Monitoring & Maintenance

View Execution Logs

To see what the automation is doing:

  1. Open Apps Script
  2. Open your “Jekyll Auto-Publisher” project
  3. Click Executions icon on left sidebar (looks like a list)
  4. You’ll see every run with:
    • Date/time
    • Status (Success/Failed)
    • Duration
  5. Click any execution to see detailed logs

    Understanding the Logs

Successful run looks like:

Email Notifications (Optional)

To get emailed when posts are published:

  1. Open your script
  2. Find the CONFIG section
  3. Change these lines:
  4. Save the script
  5. You’ll now get emails summarizing what was published

    Reset Everything (Use with Caution)

If you need to republish all posts:

  1. In Apps Script editor, select function: resetAllTracking
  2. Click Run
  3. Confirm you want to reset
  4. All posts will be republished on next hourly run Warning: This will overwrite any manual edits you made directly on GitHub.

Troubleshooting

Posts aren’t publishing

Check these:

  1. ? Trigger is enabled (clock icon in Apps Script)
  2. ? Document is in correct folder
  3. ? Document doesn’t start with “DRAFT:”
  4. ? Execution log shows no errors
  5. ? GitHub token is valid
  6. ? Repository name is spelled correctly

    Images aren’t showing

Check these:

  1. ? Images are in document (not just links)
  2. ? imagesPath in CONFIG matches your Jekyll setup
  3. ? Check GitHub - are images actually uploaded?
  4. ? Check markdown file - are image paths correct?

    “Authorization required” error

Fix:

  1. Go to Apps Script editor
  2. Click Run to re-authorize
  3. Follow authorization prompts again

    GitHub API rate limit

If you hit limits:

  1. GitHub allows 5000 requests per hour
  2. Each post uses ~1-5 requests (depending on images)
  3. You’re very unlikely to hit this limit
  4. If you do, wait an hour and try again

    Script times out

If processing takes too long:

  1. Reduce number of images per post
  2. Or split large posts into multiple documents
  3. Google limits script execution to 6 minutes

    Security Best Practices

Protecting Your Token

  1. ? Never share your GitHub token
  2. ? Never commit the script to a public repo
  3. ? Rotate token periodically (regenerate every 6-12 months)
  4. ? Use minimum permissions (only “repo” scope)
  5. ? Revoke immediately if compromised

    Revoking a Token

If your token is compromised:

  1. Go to GitHub Tokens
  2. Find “Jekyll Auto-Publisher”
  3. Click Delete
  4. Generate a new token
  5. Update the script with new token

    Advanced Customization

Change Check Frequency

To check daily instead of hourly:

  1. Go to Triggers (clock icon)
  2. Click the three dots next to your trigger
  3. Click Edit
  4. Change “Hour timer” to “Day timer”
  5. Choose time of day
  6. Save

    Multiple Folders

To watch multiple folders:

  1. Create additional folders in Google Drive
  2. Get their folder IDs
  3. Duplicate the trigger in Apps Script
  4. Create a second CONFIG for the new folder
  5. Modify checkForNewPosts() to use different CONFIG based on trigger

    Custom Commit Messages

To include post title in commit:

Find this line in the script:

Change to:

Different Author Per Post

To support multiple authors:

Add a custom property to each Google Doc:

  1. File ? File properties ? Custom properties
  2. Add property: author = “Author Name”
  3. Modify script to read this property

    What’s Happening Behind the Scenes

Every hour, the script:

  1. ? Checks the “Blog Posts” folder
  2. ? Compares each doc’s last modified date
  3. ? For new/updated docs (not starting with “DRAFT:”):
    • Converts to Markdown with Jekyll frontmatter
    • Extracts all images
    • Generates proper filenames
  4. ? Pushes to GitHub:
    • Creates/updates markdown file in _posts/
    • Uploads images to assets/images/
    • Makes a commit
  5. ? Marks documents as processed
  6. ? Logs results
  7. ? Sends notification (if enabled) GitHub Pages then:

  8. Detects the new commit
  9. Rebuilds your Jekyll site
  10. Deploys updated site (1-2 minutes)

    Cost Breakdown

Total Cost: $0.00

Success Checklist

Before you start using the system, verify:

Going forward, here’s all you need to do:

  1. Write post in “Blog Posts” folder
  2. Wait (up to 1 hour)
  3. Post is live! That’s it. No manual export, no file management, no command line. Just write and publish.

Next Steps

  1. Create a test post right now to verify everything works
  2. Check your site in about an hour to see it published
  3. Start writing your next blog post! Enjoy your automated publishing system! ?

Tagged .