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

lib/Hakyll/Check.hs: support link-checking in *.xhtml files. #969

Merged
merged 1 commit into from
Apr 3, 2023
Merged

lib/Hakyll/Check.hs: support link-checking in *.xhtml files. #969

merged 1 commit into from
Apr 3, 2023

Conversation

orlitzky
Copy link
Contributor

@orlitzky orlitzky commented Feb 9, 2023

The Hakyll "check" command is used to validate links in your site's output, but at the moment it only checks ".html" files. There is also an "xhtml" extension associated with the application/xhtml+xml MIME type that more or less contains HTML.

It's important for authors to use a different extension on xhtml+xml files because browsers interpret them differently (they use a faster but stricter parser). Thus simply renaming those files to "html" is not recommended. Instead this commit teaches Hakyll to check "xhtml" files as well.

A more thorough change would allow the user to specify what extensions to consider as "html" -- for example, "htm" and "xhtm" are both common. I however see little need for the complexity, since no one else has hit the issue in so many years. This commit therefore makes the smallest change possible and hard-codes "xhtml" as an additional extension to be checked.

Notably, I have not added "index.xhtml" as a default document in checkFileExists, because developing locally (file://) I'm forced to avoid such things in the first place.

The Hakyll "check" command is used to validate links in your site's
output, but at the moment it only checks ".html" files. There is also
an "xhtml" extension associated with the application/xhtml+xml MIME
type that more or less contains HTML.

It's important for authors to use a different extension on xhtml+xml
files because browsers interpret them differently (they use a faster
but stricter parser). Thus simply renaming those files to "html" is
not recommended. Instead this commit teaches Hakyll to check "xhtml"
files as well.

A more thorough change would allow the user to specify what extensions
to consider as "html" -- for example, "htm" and "xhtm" are both
common. I however see little need for the complexity, since no one
else has hit the issue in so many years. This commit therefore makes
the smallest change possible and hard-codes "xhtml" as an additional
extension to be checked.

Notably, I have not added "index.xhtml" as a default document in
checkFileExists, because developing locally (file://) I'm forced to
avoid such things in the first place.
@Minoru Minoru merged commit 201be22 into jaspervdj:master Apr 3, 2023
@Minoru
Copy link
Collaborator

Minoru commented Apr 3, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants