I built my personal site using Jekyll (repository).
I created a plugin to retrieve information from my Medium account and populate my site's "Blog Posts" page, this is the plugin. This plugin creates a collection called medium_posts_json
which I iterate over in my blog posts page.
I am also using the Jekyll Actions GitHub action because the vanilla GitHub pages do not support custom plugins. In order to use this action I added a workflow file here.
This GitHub action pushes the built site into a branch called gh-pages
, and when I look at the page with the generated Blog Posts it contains all expected entries and that my plugin worked successfully (the list in the Blog Posts page is populated using the plugin I created).
The problem is that this is not the page presented on the live site! In my live site, the Blog Posts page is empty, this means that the HTML file in my gh-pages
branch is not the same as the live one.
Why is that? Isn't GitHub supposed to host the content of the branch I specified? How do I even start debugging this? When I build the website locally and upload the static contents using .nojekyll
it works just fine, but I wanted to use the GitHub action to automate this process, so I won't have to rebuild manually every time I post on Medium.
Thanks.
GitHub will not host the content from the branch when you do not deploy it.
The GitHub action you use ( https://github.com/helaili/jekyll-action) is triggered when a commit is pushed to master but it only
gh-pages
).Because your workflow is only triggered on commit, you need to set up something to run the build every x day, e.g. a runner.
I have forked your repo and set up the action as you did:
name: Build and deploy Jekyll site to GitHub Pages
on:
push:
branches:
- master
jobs:
github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-
- uses: helaili/[email protected] # Choose any one of the Jekyll Actions
with: # Some relative inputs of your action
token: ${{ secrets.JEKYLL_PAT }}
target_branch: 'gh-pages'
env:
JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }}
To get it running, I have used the default GitHub pages deployment action to deploy the page, as you can see here: https://cadamini.github.io/erap129.github.io/ (follow the link on the index to see the blog posts).
In GitHub, I have configured that the site is built from the gh-pages
branch (root folder):