Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect page is processed as Markdown #114

Closed
benbalter opened this issue Jul 11, 2016 · 20 comments
Closed

Redirect page is processed as Markdown #114

benbalter opened this issue Jul 11, 2016 · 20 comments

Comments

@benbalter
Copy link
Contributor

Steps to reproduce

  1. Create a document (e.g., post)

  2. Add the following YAML front matter:

    redirect_to: /foo/

Expected

Generated redirect output has a valid <doctype> tag.

Actual:

Doctype tag is HTML entity encoded and appears in the rendered page.

@pathawks
Copy link
Member

pathawks commented Jul 11, 2016

I can add that this only happens when the document is not HTML. If the document has an .md extension, Jekyll will process it as Markdown, and the Markdown processor will mangle the <!DOCTYPE> tag.

@pathawks pathawks changed the title Doctype tag of resulting document redirects is HTML encoded Redirect page is processed as Markdown Jul 11, 2016
@pathawks
Copy link
Member

When a document has been loaded from a file with a .md extension, Jekyll will recognize that this file needs to be fed through a Markdown converter. The issue comes when the document contains redirect_to in the YAML front matter. We replace the content of the document with our redirect page, and can override the layout key so that no other layout is applied, but if the original document had a .md extension then Jekyll will still try to process the page as Markdown.

I do not know how to convince Jekyll not to convert a Convertible once it has been loaded. There is no way to change the file extension of an already loaded Document.

Any ideas, @jekyll/core?

@pathawks pathawks added the bug label Jul 12, 2016
@parkr
Copy link
Member

parkr commented Jul 12, 2016

@pathawks Do you know why HTML is even parsed this way by kramdown? It usually allows HTML to pass through.

@pathawks
Copy link
Member

That's a good question; I do not know the answer.

@parkr
Copy link
Member

parkr commented Jul 14, 2016 via email

@benbalter
Copy link
Contributor Author

Should we just document this and live with it? A bit sad but it seems outside of our hands.

The problem is, out of the box, our default template does not work with documents. Could we remove the doctype declaration entirely?

@pathawks
Copy link
Member

The problem is, out of the box, our default template does not work with documents.

It's just a Markdown issue, right? Renaming the file to have an .html extension fixes the issue.

Our redirect template is designed to be served as is, without mangling from Markdown or any other processor. Removing the doctype would fix this problem, but there is no guarantee that other problems won't arise with other Markdown processors or future updates to Kramdown.

If there is no way to bypass Jekyll's converters entirely, it seems to be that the best solution is to document that users must use .html for redirect pages, and possibly warn users at build time if a redirect page does not have an .html extension.

@benbalter
Copy link
Contributor Author

Renaming the file to have an .html extension fixes the issue.

Duh. Not sure why I didn't think of that. If it has no content, it shouldn't be an issue.

@parkr
Copy link
Member

parkr commented Jul 15, 2016

If there is no way to bypass Jekyll's converters entirely, it seems to be that the best solution is to document that users must use .html for redirect pages, and possibly warn users at build time if a redirect page does not have an .html extension.

❤️ these two suggestions.

benbalter referenced this issue in MikeMcQuaid/mikemcquaid.com Sep 12, 2016
@jekyllbot
Copy link
Contributor

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.

@benbalter
Copy link
Contributor Author

If there is no way to bypass Jekyll's converters entirely, it seems to be that the best solution is to document that users must use .html for redirect pages, and possibly warn users at build time if a redirect page does not have an .html extension.

Still outstanding.

@jekyllbot
Copy link
Contributor

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.

@benbalter
Copy link
Contributor Author

I think this should be fixed on master after #131.

@jekyllbot jekyllbot removed the stale label Dec 30, 2016
@parkr
Copy link
Member

parkr commented Dec 30, 2016

@benbalter If it is, would you please ship a quick test? :)

@jekyllbot
Copy link
Contributor

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.

@parkr
Copy link
Member

parkr commented Jan 23, 2017

@pathawks, maybe you could ship a quick test? ❤️

@jekyllbot jekyllbot removed the stale label Jan 23, 2017
@jekyllbot
Copy link
Contributor

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.

@benbalter
Copy link
Contributor Author

This issue needs a test to confirm redirect pages are processed as non-munged HTML before it can be closed.

@jekyllbot jekyllbot removed the stale label Mar 24, 2017
@parkr
Copy link
Member

parkr commented Mar 24, 2017

If you add the pinned label, jekyllbot will stop trying to close it.

If you submit a PR to add a test & merge it, jekyllbot won't see this as open anymore :trollface: 😜

@jekyllbot
Copy link
Contributor

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.

@jekyll jekyll locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants