juusaw / amp-jekyll

Build Accelerated Mobile Page versions of your Jekyll posts
MIT License
281 stars 59 forks source link

Invalid colon #21

Closed tanrax closed 7 years ago

tanrax commented 7 years ago
         ERROR: YOUR SITE COULD NOT BE BUILT:
                ------------------------------------
                The URL /:title/ is invalid because it contains a colon.
juusaw commented 7 years ago

Hi!

I haven't seen an error like that before. It looks like the :title symbol is being interpreted literally. Are you sure this bug is caused by amp-jekyll? If so, could you add some more information on your setup, like Jekyll version and _config.yml keys related to the plugin?

tanrax commented 7 years ago

Yes, it happens to me with amp-jekyll hehe. My _config.yml where it fails

defaults:
  -
    scope:
      path: '_posts'
    values:
      layout: items/blog-single
      permalink: /:title/
      status: publish
      published: true
  -
davebowker commented 7 years ago

Same issue here. My error code shows the error occurring at search.json, but if I delete that file it then errors the same colon message at sitemap.xml, then I delete that and it generally just errors on the bad colon issue.

Looks like an issue within amp_generate.rb. Latest jekyll version and in config I tried both ampdir: _posts/ and ampdir: amp/

  Liquid Exception: The URL /blog/:title/ is invalid because it contains a colon. in search.json
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    The URL /blog/:title/ is invalid because it contains a colon.
[11:57:57] 'jekyll:dev' errored after 5.72 s
tanrax commented 7 years ago

Has there been any progress? I would love to be able to apply this plugin :)

garethjohnsdesign commented 7 years ago

Has anyone found a solution to this yet?

davebowker commented 7 years ago

I think @juusaw has left this project to die 👎

juusaw commented 7 years ago

Hi,

No, I'm not planning to abandon the project. I haven't unfortunately have the time to respond to issues or develop the plugin as I haven't done any Jekyll development in some time. As this problem seems to affect many people, I really want to get it solved. However, so far I have not succeeded in reproducing it. Does anyone have a public repository that can be built to reproduce this?

For me, adding the same permalink configuration did not cause the build to fail. I run my site on Jekyll 3.4.2. I'd also like to find out whether this is a version-specific bug.

garethjohnsdesign commented 7 years ago

Here is a public repo that I've been trying it on https://github.com/garethjohnsdesign/geckoboard.com, can you spot anything I'm doing wrong?

juusaw commented 7 years ago

I managed to reproduce the issue and did some digging around Jekyll source. It seemt that the issue is indeed caused by the global permalink configuration. For some reason, the generator method doesn't receive the correct url value (even though it does have the correct value for its dir). All the generated pages get the literal permalink template (for example /blog/:title) as the urlvalue. Jekyll versions below 3.5 fail on generation with the error mentioned in the issue while newer versions generate the files to a wrong location with no warning.

I was able to set the value manually which seems to help with both global and post-specific permalink configuration. I made a new release of the plugin (1.0.2). I'll keep the issue open for some time as I was not able to test the solution too extensively – I use the default permalink format for my site and am not familiar with all possible use cases. Please let me know if the fix works for you guys so I can get the issue closed.