lib/Hakyll/Check.hs: support link-checking in *.xhtml files. #969
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.