Search code examples
jekyllliquidgithub-pagesjekyll-extensions

Liquid syntax error for 'gist' tag with github-pages gem for Jekyll


I have a Jekyll site that is hosted on Github Pages. I am trying to get my site to render locally before I push to Github, but I get the following error when running bundle exec jekyll serve --safe:

Liquid Exception: Liquid syntax error (line 13): Unknown tag 'gist'

My _config.yml contains the following (among other things):

gems:
  - jekyll-gist

My Gemfile is as follows:

source 'https://rubygems.org'
gem 'github-pages'

And bundle show jekyll-gist shows a path to the gem that is installed.

I'm stumped!


Solution

  • The --safe argument means "Disable custom plugins, and ignore symbolic links", which means it will ignore the jekyll-gist gem.

    https://jekyllrb.com/docs/configuration/

    You can get around this by amending your _config.yml to match what Github will use when rendering your site on their servers.

    github: [metadata]
    kramdown:
      input: GFM
      hard_wrap: false
    gems:
      - jekyll-coffeescript
      - jekyll-gist
      - jekyll-mentions
      - jekyll-paginate
      - jekyll-redirect-from
    whitelist:
      - jekyll-coffeescript
      - jekyll-gist
      - jekyll-mentions
      - jekyll-paginate
      - jekyll-redirect-from
    

    I have pieced this together from a few different sources. Too bad they don't explicitly tell you to do this.