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

redirect_from generates wrong url containing an object #192

Closed musikele closed 5 years ago

musikele commented 5 years ago

Hi all.

In my post I've set this metadata:

permalink: /soap/
redirect_from: /

Tried with the array version too:

permalink: /soap/
redirect_from: 
   - /

Launching the server, i see the following index.html generated:

<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="refresh" content="0;url={"from"=>"/", "to"=>"http://localhost:4000/soap/"}" />
</head>
<body>

</body>
</html>

As you can see I get the strange content="0;url={"from"=>"/", "to"=>"http://localhost:4000/soap/"}" attribute.

How can I fix?

musikele commented 5 years ago

Going back with versions, in my Gemfile I tried all versions until I reached 0.11.0:

gem 'jekyll-redirect-from', '~>0.11.0'

Now the /index.html file is:

<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>Redirecting…</title>
<link rel="canonical" href="http://localhost:4000/soap/">
<meta http-equiv="refresh" content="0; url=http://localhost:4000/soap/">
<h1>Redirecting…</h1>
<a href="http://localhost:4000/soap/">Click here if you are not redirected.</a>
<script>location="http://localhost:4000/soap/"</script>
</html>
musikele commented 5 years ago

Heeey... my fault. From the docs:

If you want to customize the redirect template, you can. Simply create a layout in your site's _layouts directory called redirect.html.

In fact, I already had a redirect.html written by myself and I didn't notice it was conflicting with the plugin.

Renaming my custom redirect page made the plugin work.