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

Internally linking to <valid URL> which does not exist #542

Closed
daenney opened this issue Oct 5, 2019 · 5 comments
Closed

Internally linking to <valid URL> which does not exist #542

daenney opened this issue Oct 5, 2019 · 5 comments

Comments

@daenney
Copy link

daenney commented Oct 5, 2019

I'm getting a whole bunch of these:

  *  internally linking to https://daenney.github.io, which does not exist (line 61)
     <a class="back-button icon-arrow-left" href="https://daenney.github.io">Home</a>

As far as I can see, there's nothing wrong with both the <a> tag or the href, and it very much does exist.

I run HTMLProofer with {:internal_domains => ["daenney.github.io"]}. Removing this makes all the errors go away. This is rather strange to me, I don't really understand why that would be the case. It seems I'm misunderstanding what An array of Strings containing domains that will be treated as internal urls. means from the docs, but I'm not quite sure how else to interpret it?

@gjtorikian
Copy link
Owner

Some people like to write their URLs out, like this: http://www.example.com/link_to_folder.html

But sometimes, the domain is autogenerated for you. This comes up in situations where Jekyll, for example, is being used to prepend links with a base URL: {{ site.base_url }}/link_to_folder.html. (#489 and #349 might be good resources for more info.)

In your case, I would bet that changing the link to https://daenney.github.io/ (note the final slash) would work, given that all internal_domains does is substitute out the domain (regardless of HTTP/HTTPS protocol). If that fixes it then I ought to change the code or the error message here.

Although if you're generating the link yourself, and don't need internal_domains, I would usually just recommend rewriting the link itself: <a class="back-button icon-arrow-left" href="/">Home</a> and removing the option.

@daenney
Copy link
Author

daenney commented Oct 6, 2019

So it turns out the trailing slash doesn't matter, the fact hat I had omitted the protocol does. Using internal_domains => ["daenney.github.io"] or daenney.github.io/ results in the same set of errors. Using https://daenney.github.io, with or without a trailing slash, clears the error. I would've expected the protocol to not matter, so this seems like a bug to me.

As with the two issues you mentioned, this content is generated by Jekyll so I get the full/absolute URLs, domain and everything.

In case it's relevant:

  • Ruby: 2.6.5
  • html-proofer: 3.13.0

@DaveSkender
Copy link

Strangely "/" does not appear to be better. I'm getting this:

  *  internally linking to /, which does not exist (line N)
     <a href="/">...</a>

Ref: https://github.com/DaveSkender/Stock.Indicators/runs/4281193384

@gjtorikian
Copy link
Owner

You'll have to use the assume-extension option: https://github.com/gjtorikian/html-proofer#using-with-jekyll

@gjtorikian
Copy link
Owner

(Feel free to reopen if that didn't fix it!)

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