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

Expose a list of generated redirects for testing tools #125

Closed nickserv closed 7 years ago

nickserv commented 7 years ago

When using automated testing tools that may read files generated by jekyll-redirect-from, it would be useful for the gem to somehow expose a list of generated files so they could be optionally ignored. This could be any combination of setting a variable, exposing a method, setting a YAML property, or exposing a command line tool that prints filenames.

Example use case

I like using HTML Proofer with my Jekyll sites (as suggested by Jekyll's documentation), but I ran into problems with jekyll-redirect-from generating pages that fail its tests. I don't really care about testing these files because they're generated and HTML Proofer doesn't check external sites that use redirects to my site, so it makes more sense for me to ignore these files than it does to make them compliant with HTML Proofer. Right now I manually copy new internal URL redirects into a a regex that excludes files from HTML Proofer, but it would be useful to not have to define these redirects in multiple places (especially since I might forget to update my ignored files manually, causing a build to fail accidentally) by using a file list exposed by jekyll-redirect-from as a value in HTML Proofer's options.

benbalter commented 7 years ago

I'm :+1: on exposing a list of redirects in a machine-readable way (e.g., YAML, JSON). Not only could that be used for testing, it could be useful for a server to read that in and progressively provide true 301 redirects, where available.

nickserv commented 7 years ago

Great point about server redirects, I didn't think about that. I don't know that much about Jekyll plugin development, would the plugin have to write to a data file in _site in order to expose the list to another program that isn't necessarily a Jekyll plugin? I just realized that if a Ruby list is exposed directly, it might not be readable in safe mode (such as on GitHub pages).

jekyllbot commented 7 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.

pathawks commented 7 years ago

I still want this.

jekyllbot commented 7 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.

hk0i commented 7 years ago

I'm actually curious about this for the purpose of making proper server-side redirects. I'm thinking having the list plus some option in the _config.yml may serve for this. I might take a dive and look into it if I can't find another solution.

benbalter commented 7 years ago

WIP over in https://github.com/jekyll/jekyll-redirect-from/pull/147.

hk0i commented 7 years ago

Thanks :)

pathawks commented 7 years ago

Fixed in #147 :tada: