gjtorikian / html-proofer

Test your rendered HTML files to make sure they're accurate.
MIT License
1.57k stars 199 forks source link

Getting "external link" errors on an internal link #488

Closed thenor closed 6 years ago

thenor commented 6 years ago

When running html-proofer on our pelux.io site (https://github.com/Pelagicore/pelux.io) I get a External link https://pelux.io/downloads/v1.0/ failed: 404 No error Even though the link is an internal link (the link to 'PELUX 1.0' at the bottom of the 'Downloads' page).

This is the current way the link is written: [PELUX 1.0](v1.0) I have also tried writing it like this, with the same error: [PELUX 1.0]({{ site.baseurl }}{% link downloads-v1.0.md %})

When I generate it locally the link looks like this: <a href="v1.0">PELUX 1.0</a> (which to me looks very much like an internal link).

When I run "bundle exec jekyll serve" it works, but when I run "bundle exec jekyll build" and then "bundle exec htmlproofer _site" I get the above error.

gjtorikian commented 6 years ago

It may look internal, but html-proofer has no idea what the domain of your site is. If you wish for it to be considered internal, you could write the links as /downloads/v1.0/, which implies a relative path.

thenor commented 6 years ago

I tested writing it this way and got the same failure.

gjtorikian commented 6 years ago

I can't reproduce this:

pelux.io (master): be jekyll build
Configuration file: /Users/gjtorikian/Desktop/pelux.io/_config.yml
            Source: /Users/gjtorikian/Desktop/pelux.io
       Destination: /Users/gjtorikian/Desktop/pelux.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 0.669 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
pelux.io (master): bundle exec htmlproofer --url-ignore \"/pelux.io/downloads/\" _site
Running ["LinkCheck", "ImageCheck", "ScriptCheck"] on ["_site"] on *.html... 

Checking 80 external links...
Ran on 17 files!

HTML-Proofer finished successfully.
pelux.io (master): bundle exec htmlproofer _site                                      
Running ["LinkCheck", "ImageCheck", "ScriptCheck"] on ["_site"] on *.html... 

Checking 80 external links...
Ran on 17 files!

HTML-Proofer finished successfully.

Was the initial issue fixed on the site? I do still see

<h2 id="older-releases-not-maintained">Older releases (not maintained)</h2>
<ul>
  <li><a href="v1.0">PELUX 1.0</a></li>
</ul>

in the output.

thenor commented 6 years ago

The page is generated correctly, but I still see the error for the "PELUX 1.0" link if I run html-proofer on it. I did a --url-ignore \"/pelux.io/downloads/\" _site" to get around the error in the tests.

gjtorikian commented 6 years ago

I see it, too; what I'm saying is in the output above, even without --url-ignore, the error is not reproducible:

HTML-Proofer finished successfully.
pelux.io (master): bundle exec htmlproofer _site                                      
Running ["LinkCheck", "ImageCheck", "ScriptCheck"] on ["_site"] on *.html... 

Checking 80 external links...
Ran on 17 files!

HTML-Proofer finished successfully.

Can I ask what operating system you're running this command on?

thenor commented 6 years ago

I was running this on Ubuntu 18.04. I tried running it myself again and now I don't see the error either. When I check back on the logs I see that the issue occurs when I have bundler version 1.15.1, but now when I run it I have version 1.16.1 and don't see the issue.