jekyll / jekyll-redirect-from

:twisted_rightwards_arrows: Seamlessly specify multiple redirections URLs for your pages and posts.
MIT License
782 stars 114 forks source link

Jekyll 3.2 breaks jekyll-redirect-from if URL has colon #119

Closed akoeplinger closed 8 years ago

akoeplinger commented 8 years ago

Add this to the frontmatter of a page:

redirect_from:
  - /bar:foo/

Since Jekyll 3.2 this now throws the following error during build:

alexander@ubuntu-desktop:~/dev/test$ bundle exec jekyll build
Configuration file: /home/alexander/dev/test/_config.yml
            Source: /home/alexander/dev/test
       Destination: /home/alexander/dev/test/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Liquid Exception: The URL /bar:foo/ is invalid because it contains a colon. in /_layouts/default.html
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    The URL /bar:foo/ is invalid because it contains a colon.

The culprit seems to be this PR in Jekyll https://github.com/jekyll/jekyll/pull/5069 which throws this error now while it worked in the past.

I noticed this in one of my site which has a large collection of legacy links from MediaWiki which contain colons in the URL.

peterjc commented 8 years ago

We also use colons in permalinks to preserve legacy MediaWiki URLs for https://github.com/biopython/biopython.github.io - e.g.:

$ head -n 8 wiki/Category_Cookbook.md 
---
title: Cookbook Entries
permalink: wiki/Category:Cookbook
layout: tagpage
tag: Cookbook
---

The entries contained in the Cookbook category are designed to

We link to them using e.g. from wiki/Documentation.md using:

-   [Wiki documentation](Category%3AWiki_Documentation "wikilink")

Note the colon in the relative link is escaped in the Markdown as %3A - this was working until the recent Jekyll update.

We also use colons with redirect_from, e.g.

$ head wiki/GSoC2011_mtrellet.md
---
title: GSoC2011 mtrellet
permalink: wiki/GSoC2011_mtrellet
layout: wiki
redirect_from:
 - /wiki/User:Mtrellet
---

Author & Mentors
----------------

I've just filed https://github.com/jekyll/jekyll/issues/5284 on this.

benbalter commented 8 years ago

@parkr it looks like you were involved in the original decision here.. can you weigh in a bit on the reasoning and possible workarounds?

pathawks commented 8 years ago

The reasoning: jekyll/jekyll-paginate#8

benbalter commented 8 years ago

Does redirect_from: Category%3AWiki_Documentation produce the desired output? I tested locally and the build completes.

akoeplinger commented 8 years ago

@benbalter yes, that seems to work and produces the correct filename with colon on disk.

peterjc commented 8 years ago

Percent encoding the colons in redirect_from alone does not fix jekyll build for me - there are likely other issues including permalink for us, hopefully will be resolved via https://github.com/jekyll/jekyll/issues/5284

pathawks commented 8 years ago

Closing because this is a Jekyll core issue, rather than specific to this plugin.