Posts

Showing posts with the label fuckinggoodmovies

how to deploy your migrated jekyll site to github pages and keep it updated

Why GitHub Pages is ideal for hosting your Jekyll site

Once you've migrated from WordPress to Jekyll, hosting becomes simpler, cheaper, and often faster. One of the most beginner-friendly options is GitHub Pages, which supports Jekyll natively and offers free hosting with version control baked in.

In this guide, you'll learn how to deploy your newly structured Jekyll site to GitHub Pages and keep your changes updated without touching a server or CMS interface ever again.

Step 1: Prepare your Jekyll site for GitHub Pages

First, structure your Jekyll site according to GitHub Pages' expectations:

  • Ensure your site builds successfully with jekyll build
  • Use a clean folder structure: _posts/, _layouts/, _includes/, _config.yml
  • Avoid unsupported plugins (unless deploying via Actions)

You can host in two ways:

  1. User/organization site: repo named username.github.io
  2. Project site: any repo name, deployed from a specific branch (e.g. gh-pages)

For most blogs or documentation projects, a project site is more flexible.

Step 2: Push your Jekyll source to GitHub

  1. Create a new GitHub repository (public or private)
  2. In your local terminal:
git init
git remote add origin https://github.com/yourusername/yourrepo.git
git add .
git commit -m "Initial Jekyll commit"
git push -u origin main

Now your source code lives in GitHub. Next, configure the deployment process.

Step 3: Use GitHub Actions to build and deploy Jekyll

GitHub Pages no longer builds Jekyll sites with custom plugins by default. For more flexibility, you can automate builds using GitHub Actions.

Minimal example workflow:

# .github/workflows/deploy.yml
name: Deploy Jekyll site

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.2'
      - name: Install dependencies
        run: |
          gem install bundler
          bundle install
      - name: Build site
        run: bundle exec jekyll build
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./_site

This setup builds your Jekyll site and pushes the output from _site/ to the gh-pages branch.

Step 4: Enable GitHub Pages from the right branch

In your repository settings:

  • Go to Pages under Settings
  • Choose Deploy from a branch
  • Pick gh-pages as the source and / (root) as the folder

GitHub will now serve your site at:

https://yourusername.github.io/yourrepo/

Step 5: Connect a custom domain (optional)

To use a custom domain like mysite.com, follow these steps:

  1. Create a CNAME file at the root of your project with your domain:
www.mysite.com
  1. Set up DNS records pointing to GitHub:
Type: CNAME
Host: www
Value: yourusername.github.io
  1. Enable HTTPS in GitHub Pages settings

DNS propagation may take a few hours. Your custom domain will now serve your Jekyll site securely.

Step 6: Automate content updates and backups

Because everything is version-controlled, updating your content is as simple as:

git add .
git commit -m "New blog post"
git push

Within seconds, your Action workflow will rebuild and publish the changes. You can also:

  • Set up a cron job to rebuild nightly (for dynamic content)
  • Trigger builds from external sources using GitHub API
  • Mirror your repo to a backup service (e.g. GitLab or Bitbucket)

Step 7: Use GitHub Issues or Discussions for feedback

GitHub isn’t just for code. If you want to enable reader interaction post-WordPress:

  • Use utterances or giscus for GitHub-powered comments
  • Link blog content to GitHub Issues for feedback threads
  • Create a separate repo for Q&A using GitHub Discussions

Step 8: Monitor your deployment status

Every time you push, you can see the status in GitHub under the Actions tab.

  • Green check means success
  • Red X means build failed—check logs

You can also set up email or Slack notifications using Actions or webhooks for important events.

Conclusion

By deploying your Jekyll site to GitHub Pages, you remove the need for costly hosting, insecure CMS plugins, and complicated update cycles. Once set up, every post or content change becomes a commit, and every deployment becomes automatic. The result is a modern, secure, and fast publishing workflow built for the long haul.

In the next article, we’ll explore how to design your Jekyll site for performance and SEO optimization—ensuring your new static setup not only works, but wins.