New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog posts with trailing slashes no longer work in Jekyll 3 #4440

Closed
daattali opened this Issue Feb 2, 2016 · 17 comments

Comments

Projects
None yet
9 participants
@daattali
Contributor

daattali commented Feb 2, 2016

(crosspost from jekyll-talk)

I host a GitHub Pages site, and since its upgrade to Jekyll 3, I've noticed myself and from other people that pages that previously worked both with and without a trailing slash no longer work with a trailing slash. This can be problematic because there are many URLs out there on the web linking to pages with a trailing slash, and now they're all 404s. I temporarily wrote a hacky JavaScript redirection , but is there a proper fix for this? Is this a deliberate behaviour by the new Jekyll?

@jezen

This comment has been minimized.

Show comment
Hide comment
@jezen

jezen Feb 2, 2016

+1.

All my links recently 404d, so I had to explicitly add trailing slashes to permalinks in all of my posts.

😞

jezen commented Feb 2, 2016

+1.

All my links recently 404d, so I had to explicitly add trailing slashes to permalinks in all of my posts.

😞

@daattali

This comment has been minimized.

Show comment
Hide comment
@daattali

daattali Feb 2, 2016

Contributor

I'd mainly like to know if this was a deliberate change of behaviour, or if it's a regression bug

Contributor

daattali commented Feb 2, 2016

I'd mainly like to know if this was a deliberate change of behaviour, or if it's a regression bug

@ploeh

This comment has been minimized.

Show comment
Hide comment
@ploeh

ploeh Feb 2, 2016

I'm having this problem as well. Although I've deliberately removed the trailing slashes when providing links manually, Google has indexed my site with the slashes.

Hundreds of links no longer work 😞

ploeh commented Feb 2, 2016

I'm having this problem as well. Although I've deliberately removed the trailing slashes when providing links manually, Google has indexed my site with the slashes.

Hundreds of links no longer work 😞

@daattali

This comment has been minimized.

Show comment
Hide comment
@daattali

daattali Feb 2, 2016

Contributor

Yes, @kevinushey also mentioned that this broke all the google indexing links...

For anyone who comes to this issue, a temporary workaround is to use javascript to remove the trailing slash on the 404 page, see example on my site

Contributor

daattali commented Feb 2, 2016

Yes, @kevinushey also mentioned that this broke all the google indexing links...

For anyone who comes to this issue, a temporary workaround is to use javascript to remove the trailing slash on the 404 page, see example on my site

ploeh added a commit to ploeh/ploeh.github.com that referenced this issue Feb 2, 2016

Added hack for trailing slashes,
which no longer work on GitHub pages
(jekyll/jekyll#4440).
@pathawks

This comment has been minimized.

Show comment
Hide comment
@pathawks

pathawks Feb 2, 2016

Member

Do you have a specific example of something that worked with Jekyll 2 and not with Jekyll 3?
I imagine this has to do with #3490, but it is difficult to say without specific details.

It does not sound like anything has been broken, but it is difficult to know for sure without specific steps to recreate the problem.

Member

pathawks commented Feb 2, 2016

Do you have a specific example of something that worked with Jekyll 2 and not with Jekyll 3?
I imagine this has to do with #3490, but it is difficult to say without specific details.

It does not sound like anything has been broken, but it is difficult to know for sure without specific steps to recreate the problem.

@daattali

This comment has been minimized.

Show comment
Hide comment
@daattali

daattali Feb 2, 2016

Contributor

@pathawks All my blog posts on my GitHub Pages-hosted website automatically had a trailing slash at the end, and there are many links online to my blog posts with a trailing slash. For example, http://deanattali.com/2015/05/09/setup-rstudio-shiny-server-digital-ocean/ was the URL to a popular blog post, but it now doesn't work (I added a hacky javascript redirect for now). This also means that all my Disqus comments (there were about 100 comments on that page) now disappeared because Disqus registered that post as having a trailing slash, but now I have to remove that slash in order to have the page render.

Contributor

daattali commented Feb 2, 2016

@pathawks All my blog posts on my GitHub Pages-hosted website automatically had a trailing slash at the end, and there are many links online to my blog posts with a trailing slash. For example, http://deanattali.com/2015/05/09/setup-rstudio-shiny-server-digital-ocean/ was the URL to a popular blog post, but it now doesn't work (I added a hacky javascript redirect for now). This also means that all my Disqus comments (there were about 100 comments on that page) now disappeared because Disqus registered that post as having a trailing slash, but now I have to remove that slash in order to have the page render.

@envygeeks

This comment has been minimized.

Show comment
Hide comment
@envygeeks

envygeeks Feb 2, 2016

Contributor

Change your default permalink to have index.html at the end and it will be bring back the trailing slash, the problem is we switched to /page.html which Github supports for Pretty URL's, trailing slashes are added by their server when it's folder because they don't disable them.

Contributor

envygeeks commented Feb 2, 2016

Change your default permalink to have index.html at the end and it will be bring back the trailing slash, the problem is we switched to /page.html which Github supports for Pretty URL's, trailing slashes are added by their server when it's folder because they don't disable them.

@kevinushey

This comment has been minimized.

Show comment
Hide comment
@kevinushey

kevinushey Feb 2, 2016

Contributor

If I understand correctly, the issue (at least as I experienced it on a blog I contribute to) related to how Jekyll 2 constructed permalinks based on the _config.yml's permalink: field:

  • Jekyll 2 automatically added trailing slashes to permalinks, even if none was provided in the permalink: field;
  • Jekyll 3 now supports + respects the absence of a trailing slash in the permalink: field.

Without that change, Jekyll was now generating links without a trailing slash, and the links including a trailing slash would 404. Unfortunately, since Google had already indexed links with a trailing slash, those were now 404s.

A blog I contribute to, the Rcpp Gallery, was affected by this -- we fixed it by ensuring our _config.yml had a trailing slash for the permalink: field: RcppCore/rcpp-gallery@70fc860

I think the Jekyll 3 behavior is correct, but this change could have been better advertised / documented, I think.

Also note that with this scheme no-trailing-slash seems to correctly redirect to with-trailing-slash, so both ways of accessing the page seem to be okay.

Contributor

kevinushey commented Feb 2, 2016

If I understand correctly, the issue (at least as I experienced it on a blog I contribute to) related to how Jekyll 2 constructed permalinks based on the _config.yml's permalink: field:

  • Jekyll 2 automatically added trailing slashes to permalinks, even if none was provided in the permalink: field;
  • Jekyll 3 now supports + respects the absence of a trailing slash in the permalink: field.

Without that change, Jekyll was now generating links without a trailing slash, and the links including a trailing slash would 404. Unfortunately, since Google had already indexed links with a trailing slash, those were now 404s.

A blog I contribute to, the Rcpp Gallery, was affected by this -- we fixed it by ensuring our _config.yml had a trailing slash for the permalink: field: RcppCore/rcpp-gallery@70fc860

I think the Jekyll 3 behavior is correct, but this change could have been better advertised / documented, I think.

Also note that with this scheme no-trailing-slash seems to correctly redirect to with-trailing-slash, so both ways of accessing the page seem to be okay.

@daattali

This comment has been minimized.

Show comment
Hide comment
@daattali

daattali Feb 2, 2016

Contributor

Thanks @envygeeks, I tried that, and you're right that now old links work and I can access the page with a trailing slash. But now the default URL for each blog post contains .index.html, which is different from the previous URL. So if you are on the landing page of the blog and are navigating to a post from the paginator, this will break Disqus comments because the URL will contain .index.html while the traditional URL didn't have it. Is there a way around this?

Contributor

daattali commented Feb 2, 2016

Thanks @envygeeks, I tried that, and you're right that now old links work and I can access the page with a trailing slash. But now the default URL for each blog post contains .index.html, which is different from the previous URL. So if you are on the landing page of the blog and are navigating to a post from the paginator, this will break Disqus comments because the URL will contain .index.html while the traditional URL didn't have it. Is there a way around this?

@ploeh

This comment has been minimized.

Show comment
Hide comment
@ploeh

ploeh Feb 2, 2016

Change your default permalink to have index.html at the end

If I understand this suggestion correctly, the suggestion is to have permalinks defined like this in _config.yml:

permalink: /:year/:month/:day/:title/index.html

This looks like it sort of works with the trailing slashes, but also causes all permalinks to now be generated with /index.html (e.g. http://localhost:4000/2015/12/22/tail-recurse/index.html). This would mean that I'm now putting a technical concern into the URLs of my articles, which goes against the philosophy of the WWW, as outlined by Sir Tim Berners-Lee.

This is, in my opinion, not an acceptable solution, because it'd make it more difficult for me to change platform in the future (nothing lasts forever).

ploeh commented Feb 2, 2016

Change your default permalink to have index.html at the end

If I understand this suggestion correctly, the suggestion is to have permalinks defined like this in _config.yml:

permalink: /:year/:month/:day/:title/index.html

This looks like it sort of works with the trailing slashes, but also causes all permalinks to now be generated with /index.html (e.g. http://localhost:4000/2015/12/22/tail-recurse/index.html). This would mean that I'm now putting a technical concern into the URLs of my articles, which goes against the philosophy of the WWW, as outlined by Sir Tim Berners-Lee.

This is, in my opinion, not an acceptable solution, because it'd make it more difficult for me to change platform in the future (nothing lasts forever).

@envygeeks

This comment has been minimized.

Show comment
Hide comment
@envygeeks

envygeeks Feb 2, 2016

Contributor

@ploeh @daattali See: https://github.com/jekyll/jekyll/blob/master/lib/site_template/_includes/head.html#L10 on how to fix that problem now, which is how we (at EnvyGeeks) do it for all our production sites regardless of how we build the permalinks (and whether or not we host it on Github or on EnvyGeeks / otherwise.)

Contributor

envygeeks commented Feb 2, 2016

@ploeh @daattali See: https://github.com/jekyll/jekyll/blob/master/lib/site_template/_includes/head.html#L10 on how to fix that problem now, which is how we (at EnvyGeeks) do it for all our production sites regardless of how we build the permalinks (and whether or not we host it on Github or on EnvyGeeks / otherwise.)

@envygeeks

This comment has been minimized.

Show comment
Hide comment
@envygeeks

envygeeks Feb 2, 2016

Contributor

Note, the canonical (while recommended it be there) is not the part you need worry about, it's the replace and other stuff that normalizes the entire URL.

Contributor

envygeeks commented Feb 2, 2016

Note, the canonical (while recommended it be there) is not the part you need worry about, it's the replace and other stuff that normalizes the entire URL.

@daattali

This comment has been minimized.

Show comment
Hide comment
@daattali

daattali Feb 2, 2016

Contributor

@kevinushey you're right I agree the current behaviour is more correct, but maybe there should be a way to keep enforcing the old behaviour .....

xkcd

But I do think Kevin's solution is the best @ploeh you should try that

Contributor

daattali commented Feb 2, 2016

@kevinushey you're right I agree the current behaviour is more correct, but maybe there should be a way to keep enforcing the old behaviour .....

xkcd

But I do think Kevin's solution is the best @ploeh you should try that

ploeh added a commit to ploeh/ploeh.github.com that referenced this issue Feb 2, 2016

@ploeh

This comment has been minimized.

Show comment
Hide comment
@ploeh

ploeh Feb 2, 2016

Thank you, @kevinushey, that seems to solve the immediate problem 👍

ploeh commented Feb 2, 2016

Thank you, @kevinushey, that seems to solve the immediate problem 👍

akhyarrh added a commit to akhyarrh/akhyarrh.github.io that referenced this issue Feb 2, 2016

@tobyspark

This comment has been minimized.

Show comment
Hide comment
@tobyspark

tobyspark Feb 3, 2016

Well, if only I had decided to do a website update tomorrow, I'd have read this in the docs! Thanks @daattali for posting about the issue as I hit it, @kevinushey for the explanation, and @daattali again for #4454

tobyspark commented Feb 3, 2016

Well, if only I had decided to do a website update tomorrow, I'd have read this in the docs! Thanks @daattali for posting about the issue as I hit it, @kevinushey for the explanation, and @daattali again for #4454

tobyspark added a commit to tobyspark/tobyz.net-via-jekyll that referenced this issue Feb 3, 2016

Jekyll 2->3 permalink fix
This will cause a major site rebuild.

Going to extensionless URLs will likely need apache fix:
http://jekyllrb.com/docs/permalinks/#extensionless-permalinks

Jekyll issue: jekyll/jekyll#4440

@jekyllbot jekyllbot closed this in 75b55ff Feb 3, 2016

@daattali

This comment has been minimized.

Show comment
Hide comment
@daattali

daattali Feb 3, 2016

Contributor

There is now a note in the jekyll 2 --> 3 migration page about this issue and how to solve it http://jekyllrb.com/docs/upgrading/2-to-3/

Contributor

daattali commented Feb 3, 2016

There is now a note in the jekyll 2 --> 3 migration page about this issue and how to solve it http://jekyllrb.com/docs/upgrading/2-to-3/

@moodmosaic

This comment has been minimized.

Show comment
Hide comment
@moodmosaic

moodmosaic Feb 3, 2016

Adding a trailing slash to the permalink template, in _config.yml, seems to be solving the problem also for me.

moodmosaic commented Feb 3, 2016

Adding a trailing slash to the permalink template, in _config.yml, seems to be solving the problem also for me.

moodmosaic added a commit to moodmosaic/blog that referenced this issue Feb 3, 2016

moyer added a commit to moyer/moyer.github.com that referenced this issue Feb 13, 2016

chrismear added a commit to shinydevelopment/shinydevelopment.github.io that referenced this issue Feb 19, 2016

Accept post URLs both with and without trailing slash.
In Jekyll 3, the trailing slash is respected in the configuration of the
permalink template. Previously, defining the permalink without a
trailing slash would let requests both with and without the trailing
slash work correctly, but in Jekyll 3 that configuration only lets
requests without the trailing slash work. By adding the trailing slash
in the definition, and running with a webserver configuration that
supports extensionless permalinks, both formats of URL are accepted.

http://jekyllrb.com/docs/permalinks/#extensionless-permalinks

jekyll/jekyll#4440 (comment)

kennydee added a commit to M6Web/m6web.github.io that referenced this issue Mar 9, 2016

dottorblaster added a commit to dottorblaster/dottorblaster.github.io that referenced this issue Mar 17, 2016

solarsailer added a commit to pixelnest/pixelnest.github.io that referenced this issue Mar 17, 2016

darwin added a commit to binaryage/blog that referenced this issue Apr 5, 2016

phstc added a commit to phstc/phstc.github.com that referenced this issue Jun 4, 2016

ahitrin added a commit to ahitrin/ahitrin.github.com that referenced this issue Jun 23, 2016

Attempt to fix missing comments
Seems that they are gone due to Jekyll 3 featurebug [1]. I've found no
possibility to fix this issue on the Disqus side, so trying to fix this
via permalink modification.

[1]: jekyll/jekyll#4440

daveyarwood added a commit to daveyarwood/blog.djy.io that referenced this issue Jul 1, 2016

shivamdixit added a commit to shivamdixit/shivamdixit.github.io that referenced this issue Aug 1, 2016

Add trailing slash. Ref jekyll/jekyll#4440
Signed-off-by: Shivam Dixit <shivamd001@gmail.com>

SimplGy added a commit to SimplGy/simplgy.github.io that referenced this issue Oct 3, 2016

anonymous-throwaway pushed a commit to anonymous-throwaway/movierama that referenced this issue Jan 3, 2017

Fix Pow SSL instructions link
The blog looks likes it's hosted on GH Pages and using Jekyll, which
had a change of behaviour around trailing slashes, see:

 - http://jekyllrb.com/docs/upgrading/2-to-3/#permalinks-no-longer-automatically-add-a-trailing-slash
 - jekyll/jekyll#4440

anonymous-throwaway pushed a commit to anonymous-throwaway/movierama that referenced this issue Jan 3, 2017

Anonymous Throwaway
Fix Pow SSL instructions link
The blog looks likes it's hosted on GH Pages and using Jekyll, which
had a change of behaviour around trailing slashes, see:

 - http://jekyllrb.com/docs/upgrading/2-to-3/#permalinks-no-longer-automatically-add-a-trailing-slash
 - jekyll/jekyll#4440

scmx added a commit to standout/webbradion.net that referenced this issue Feb 7, 2017

asafdav2 added a commit to asafdav2/asafdav2.github.io that referenced this issue Feb 22, 2017

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.