-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add option to warn about absolute internal URLs ? #436
Comments
raspberrypi/documentation#670 fixes the broken link. But it would still be nice if html-proofer could have caught it :-) |
Thanks for sharing. In general, relative URLs that start with a slash are neither discouraged nor documented as deviation from best practice. It is possible for html-proofer to make such a check. But adding such an option would not be consistent with our project scope. We encourage you to implement this, if you are interested. Please see our documentation at https://github.com/gjtorikian/html-proofer/wiki/How-to-make-a-custom-class and we will be happy to list it on our list of extensions at https://github.com/gjtorikian/html-proofer/wiki/Extensions-(custom-classes). It's really simple. You can copy the code from https://github.com/fulldecent/html-proofer-mailto_awesome as a starting point and the main code you want is probably one line of code in this file: https://github.com/fulldecent/html-proofer-mailto_awesome/blob/master/lib/mail_to_awesome.rb For now I will close this issue as out of scope for this project. |
As well, for something like this, you may be able to use the
That is: any link starting with |
Yeah, that's why I suggested it should be an option that's disabled by default, unless explicitly enabled ;-)
Oh, I would have thought it comes under the "if your internal links are working" section? :-/
I'm afraid I've never written any Ruby, so I wouldn't even know where to start :-(
Nah, that wouldn't work in this scenario. For the repo in question we need all links to be relative, because the documentation can be browsed from both https://github.com/raspberrypi/documentation and from https://www.raspberrypi.org/documentation/ |
Does this solve the problem?
|
I dunno if this is a feature that html-proofer already has (?) but if not, I think this would be a nice option to add.
In raspberrypi/documentation#669 a user found a link in https://www.raspberrypi.org/documentation/configuration/config-txt/video.md which didn't work, but this wasn't picked up by html-proofer.
In the source markdown (scroll down to the dpi_group, dpi_mode, dpi_output_format section), the link looks like
[here](/hardware/raspberrypi/dpi/README.md)
- note that it starts with a leading slash. This link works fine when viewing the page on Github (which links it tohttps://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/dpi/README.md
) and would also work fine if the HTML generated from this was being deployed to the root of a domain; but in our particular case the HTML generated from this is deployed to a subdirectory https://www.raspberrypi.org/documentation/ which means the absolute-link ends up linking tohttps://www.raspberrypi.org/hardware/raspberrypi/dpi/README.md
which 404s. (the correct link would behttps://www.raspberrypi.org/documentation/hardware/raspberrypi/dpi/README.md
)To catch situations like this (where the generated URL isn't being deployed to the root of a domain) it would be nice if html-proofer had an option (which should probably be disabled by default?) to warn if an internal URL starts with a leading slash.
The text was updated successfully, but these errors were encountered: