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

Add --ignore-internal flag #798

Closed
RichardLitt opened this issue Apr 19, 2023 · 4 comments
Closed

Add --ignore-internal flag #798

RichardLitt opened this issue Apr 19, 2023 · 4 comments

Comments

@RichardLitt
Copy link

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.

@gjtorikian
Copy link
Owner

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?

@RichardLitt
Copy link
Author

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.

@riccardoporreca
Copy link
Collaborator

@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

@RichardLitt
Copy link
Author

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!

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

No branches or pull requests

3 participants