docker-github-pages icon indicating copy to clipboard operation
docker-github-pages copied to clipboard

jekyll-seo-tag does not seem to be supported

Open adius opened this issue 7 years ago • 15 comments

 $ docker run -v "$PWD":/usr/src/app -p "4000:4000" starefossen/github-pages
Configuration file: /usr/src/app/_config.yml
Configuration file: /usr/src/app/_config.yml
            Source: /usr/src/app
       Destination: /_site
 Incremental build: enabled
      Generating...
  Liquid Exception: Liquid syntax error (line 16): Unknown tag 'seo' in /_layouts/default.html
jekyll 3.4.5 | Error:  Liquid syntax error (line 16): Unknown tag 'seo'

adius avatar Aug 31 '17 19:08 adius

It should be installed already as a dependency of the github-pages gem. You would however need to enable it in your _config.yml like this:

gems:
- jekyll-seo-tag

Starefossen avatar Aug 31 '17 20:08 Starefossen

It is enabled 😕

adius avatar Sep 01 '17 11:09 adius

Any ideas?

adius avatar Sep 27 '17 13:09 adius

@adius could you supply your _layouts/default.html file?

siliconmeadow avatar Sep 28 '17 07:09 siliconmeadow

@siliconmeadow Yes, but nothing interesting to see there

<!doctype html>
<html>
<head>
  <meta charset=utf-8 />
  <meta name=viewport content="width=device-width, initial-scale=1">
  <link rel=stylesheet media=all href=/css/screen.css>
  <link rel="shortcut icon" href=/img/favicon.png>
  <link
    rel=stylesheet
    href=//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css>
  <link
    href=/atom.xml
    rel=alternate
    title="Adrian Sieber"
    type=application/atom+xml>
  {% seo %}
</head>
<body>
…

adius avatar Sep 28 '17 08:09 adius

I've never used this gem before, but looking at http://jekyll.github.io/jekyll-seo-tag/installation/ , it says that you need to add this prior to the <head> tag:

<!-- Begin Jekyll SEO tag v2.3.0 -->
<title>Installing Jekyll SEO Tag | Jekyll SEO Tag</title>
<meta property="og:title" content="Installing Jekyll SEO Tag" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site’s content." />
<meta property="og:description" content="A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site’s content." />
<link rel="canonical" href="http://jekyll.github.io/jekyll-seo-tag/installation/" />
<meta property="og:url" content="http://jekyll.github.io/jekyll-seo-tag/installation/" />
<meta property="og:site_name" content="Jekyll SEO Tag" />
<script type="application/ld+json">
{"name":null,"description":"A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site’s content.","author":null,"@type":"WebPage","url":"http://jekyll.github.io/jekyll-seo-tag/installation/","image":null,"publisher":null,"headline":"Installing Jekyll SEO Tag","dateModified":null,"datePublished":null,"sameAs":null,"mainEntityOfPage":null,"@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->

I don't know if that would help?

siliconmeadow avatar Sep 28 '17 08:09 siliconmeadow

My mistake - just prior to the closing </head> tag - ignore my previous comment.

siliconmeadow avatar Sep 28 '17 09:09 siliconmeadow

I'm looking through the issues, and it looks like others have an _includes/head/seo.html file which shows some other ways it appears they've defined {% seo %}.

What I'm wondering is whether the problem with the jekyll-seo-tag gem in your circumstance is not that the gem isn't installed in the docker image, but that it's not correctly invoked in your templates?

siliconmeadow avatar Sep 28 '17 09:09 siliconmeadow

No, I don't think so. I've been using the plugin before with https://github.com/github/pages-gem and it worked like a charm, but I'm sick of dealing with ruby & bundler issues and that's why I wanted to use a docker based solution...

adius avatar Sep 28 '17 09:09 adius

Yeah, ruby and bundler is such a mess... 😠

Starefossen avatar Sep 28 '17 19:09 Starefossen

Long shot @adius but you might try stopping the container, deleting your Gemfile.lock and bringing docker up again to force bundler to start over. I had some weirdness with jekyll gems that went away when I blew the lock file away.

smeyfroi avatar Sep 29 '17 08:09 smeyfroi

Thanks a lot @smeyfroi. This wasn't exactly the problem, but it led me on the right way. The problem was that I didn't have a Gemfile at all 🙈 . I thought it wasn't necessary, as all dependencies are already preinstalled in the docker container.

The Liquid Exception: Liquid syntax error (line 16): Unknown tag 'seo' in /_layouts/default.html error doesn't suggest that the Gemfile is missing either.

How should this be fixed? A warning if the Gemfile is missing? Or automatically adding one?

adius avatar Sep 29 '17 09:09 adius

@adius Nice!

It is confusing, and not really explained very well in the jekyll docs (that I could find anyway).

So perhaps document that both a Gemfile and the _config.yml gems declaration is required? New plugins require additions to both files.

Also maybe worth explaining that bundler is invoked during container startup: I found myself reading the Dockerfile to understand what was going on.

And the problem I had was with gem dependency conflicts that went away when I deleted the Gemfile.lock. So perhaps that's worth noting in the docs as well, as a troubleshooting thing?

smeyfroi avatar Sep 29 '17 10:09 smeyfroi

Great writeput @smeyfroi 👍 We should definitely add this to the project README I think.

Starefossen avatar Sep 30 '17 17:09 Starefossen

I can take a look and raise a PR over the next couple days.

smeyfroi avatar Oct 02 '17 08:10 smeyfroi