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` with empty string value creates a redirect from index.html to the page I'm redirecting to #210

Closed matt-bailey closed 4 years ago

matt-bailey commented 4 years ago

I'm using jekyll-redirect-from with a Github Pages site, and Forestry Static CMS.

In Forestry I've set up a simple text field (called redirect_from) for my redirect url. If I save a page in Forestry, for example about-us.md, without entering a value in redirect_from nothing is output in the about-us.md front matter. This is fine.

However, if I enter a value, save it, and then remove the value I am left with this in my about-us.md front matter, redirect_from: '', an empty string.

The problem with this is that it causes jekyll-redirect-from to then create a redirect from index.html to about-us.html. Presumably it's still interpreting the empty string as a URL, which in this case would be the base URL of site as it's empty.

Is there any way around this? This is just the way Forestry works so, other than manually editing the markdown files, I'm a bit stuck.

ashmaroli commented 4 years ago

Not sure if this should be handled by Forestry or this plugin... /cc @DirtyF

matt-bailey commented 4 years ago

Yes, it's a tricky one. Neither the plugin or Forestry are doing anything wrong, it's just a side-effect of using them together. Really I need Forestry not to leave empty strings in my front matter, but no doubt there's a reason why you wouldn't want to do that, maybe sometimes an empty string is what you want, I have no idea?...

ashmaroli commented 4 years ago

I wonder why Forestry doesn't set the value to null when you remove the key-value..

jekyllbot commented 4 years ago

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

DirtyF commented 4 years ago

It's more likely a Forestry problem.