Relative links are not being checked
Problem
Lychee does not check relative links when run against a live URL (a.k.a. a non-local check)
Steps to reproduce
lychee https://foo.com/bar.htm --dump --verbose
where bar.htm contains the following HTML code:
<a href="my-relative-page.htm" target="_blank">This is a link to a relative page that lives in the same directory as bar.htm</a>
Expected results
Lychee checks and reports on the status of my-relative-page.htm
Actual results
Lychee does not even mention my-relative-page.htm in the report
Any help with this would be much appreciated. I've tried using --base which doesn't seem to help. I noticed the decision matrix in this project's Readme mentions the skipping of relative links as a feature, but hopefully there's a way to enable this. For context I'm working on a documentation site that makes heavy use of relative links (e.g. topic.htm or ../../relative/path/to/topic.htm)
Yes, sorry about that. Can you try the dev PR at #1624? Would be helpful if you run into any issues with it. Definitely need some more testers. 😅 You would have to build lychee from the sources, though.
@mre Thanks for the fast response! I'm glad to see there's already a fix in the works.
I'm not familiar with Rust but I did the following:
- Cloned the
relative-link-fixesbranch -
cargo install lycheefrom within thelycheedirectory -
cd ~/.cargo/bin -
./lychee https://foo.com/bar.htm --dump --verbose
Unfortunately I still don't see the relative links in the output report. If you want I can provide the link to the exact public-facing documentation page I'm using to test. However, I'd rather do that by email for privacy reasons.
Yes, the steps look correct. Sorry to hear that it still doesn't work. 😕
Can you try to explicitly set the base URL?
lychee --base https://foo.com/ https://foo.com/bar.htm --dump --verbose
Edit: You mentioned that before, but just to double-check that it still doesn't work on the relative-link-fixes branch.
@mre I confirmed it still doesn't work with --base on the relative-link-fixes branch.
As I mentioned, I'm happy to send you the exact invocation I'm running via email so you can reproduce the issue. Just don't want to expose the User-Agent field / URL in a public venue.
Edit: I've sent you an email with more information.