Starefossen / docker-github-pages

:octocat: :whale: Alpine Docker Image for GitHub Pages and Jekyll powered sites
https://registry.hub.docker.com/u/starefossen/github-pages/
MIT License
192 stars 54 forks source link

jekyll-seo-tag does not seem to be supported #16

Open adius opened 7 years ago

adius commented 7 years ago
 $ 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'
Starefossen commented 7 years ago

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
adius commented 7 years ago

It is enabled 😕

adius commented 7 years ago

Any ideas?

siliconmeadow commented 7 years ago

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

adius commented 7 years ago

@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>
…
siliconmeadow commented 7 years ago

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 commented 7 years ago

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

siliconmeadow commented 7 years ago

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?

adius commented 7 years ago

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...

Starefossen commented 7 years ago

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

smeyfroi commented 7 years ago

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.

adius commented 7 years ago

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?

smeyfroi commented 7 years ago

@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?

Starefossen commented 7 years ago

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

smeyfroi commented 7 years ago

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