jekyll / jekyll-redirect-from

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

Generating a redirect from an XML file #218

Closed despinoUY closed 3 years ago

despinoUY commented 4 years ago

I'm looking forward generating a redirect from an old XML file that my Jekyll site had. Setting a redirect_to variable would generate the right HTML but won't make the redirection because that would generate a non valid file. Is there any way to make this happen?

grosscol commented 3 years ago

The problem is going to be that the Content-Type in the header of the response is going to depend on the webserver serving out the content. Jekyll server guesses based on the file extension. So the Content-Type is application/xml; charset=utf-8 when the actual content is a redirecting HTML page. The web browser tries to parse it as XML, and that doesn't work.

You should be able to set the Content-Type of a response to whatever you like, but that's outside the scope of Jekyll entirely. If you were writing a web based application, you'd have control over the response headers in code. If you were writing an apache config, you could modify the response headers there. In short, the configuration to support this would be outside of Jekyll.

See: https://github.com/jekyll/jekyll/issues/5454 for a related discussion about serving JSON files without the .json file extension.

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