gjtorikian / html-proofer

Test your rendered HTML files to make sure they're accurate.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add --ignore-internal flag

RichardLitt opened this issue · comments

I'm using a Jekyll site. I'm having an issue where I am getting thousands of internal errors:

* At ./_site/projects/wordhoard-press/index.html:158:

  internally linking to /projects/mulefa-language/, which does not exist

However, these all work on the site itself, so they shouldn't be flagged. I can't figure out how to disable them. Would it be possible to add a flag? --only-4xx didn't seem to work for me, either.

I could, but I would rather get at the root of the problem here. It sounds like internal links are being incorrectly flagged, and fixing that seems more appropriate than finding a way to ignore them.

Is your site open source by any chance? Can I look at any logs or files to help debug?

Fair! It is - I didn't want to make this a support request, but I couldn't figure out the issue enough to know more than "maybe just ignoring these would be best."

It is. https://github.com/RichardLitt/burntfen.com. I've been running bundle exec htmlproofer --assume_extension '.html' ./_site/projects and bundle exec htmlproofer --assume_extension '.html' ./_site/. It doesn't have a BASEURL, I believe, so I don't think that was the issue here.

Thank you for your work. On a related note - I noticed you have https://opencollective.com/garen-torikian, but not a collective for html-proofer. I'd be happy to donate if you wanted to set up an OC for this project and then apply for hosting from Open Source Collective.

@RichardLitt

The failure you report is expected if you run

bundle exec htmlproofer --assume_extension '.html' ./_site/projects

since it would try to resolve the absolute internal link /projects/mulefa-language/ relative to ./_site/projects as the site root, i.e. ./_site/projects/projects/mulefa-language/

Can you re-check whether you indeed get that same error with just _site

bundle exec htmlproofer --assume_extension '.html' ./_site/

(which should not be the case)?

The correct way of invoking htmlproofer on a subdir of a site to resolve absolute links correctly is to pass --root-dir:

bundle exec htmlproofer --assume_extension '.html' --root-dir ./_site/ ./_site/projects

I think this does work. I think the issue on my end is that I just have thousands of links to update, because I've set up the site to have duplicate entries on each page, and I haven't gone through and updated it recently.

I am going to try and fix these, and I'll let you know if there are any implementation issues that warrant a feature or bug report. For now - thank you for your help, and for your work!