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

--url-ignore doesn't consider full file path #593

Open
tbm opened this issue Nov 19, 2020 · 2 comments
Open

--url-ignore doesn't consider full file path #593

tbm opened this issue Nov 19, 2020 · 2 comments
Labels

Comments

@tbm
Copy link

tbm commented Nov 19, 2020

I'm not 100% sure this is a bug, but I think so.

I generate /blog/feed/rss.xml but my pages link to /blog/feed and I specify rss.xml as the DirectoryIndex in Apache, so just /blog/feed/ works.

Obviously html-proofer doesn't know about the redirect, so I added --url-ignore /blog/feed/ (not sure if there's a better solution?).

This works for pages which have a ../blog/feed/ link, but for pages under /blog/, they have ../feed/ links - they don't mention /blog/ since they are relative links, but obviously the link is to /blog/feed/.

So I think that html-proofer should always consider the full path of a link when checking against --url-ignore. So e.g. a ../feed/ link in /blog/foo/index.html should be converted to /blog/feed/ before evaluating --url-ignore.

What do you think?

@gjtorikian
Copy link
Owner

Yeah, that's a tricky one. It sounds like during the link evaluation, it should check first to see if it's a file path (../) before expanding it, and then evaluate the ignore.

I don't have time at the moment to dig too deep into this, but I wonder if you could use --url-swap to temporarily "rewrite" these URLs? That is, something like --url-swap "../feed:../blog/feed". Also, correct me if I am wrong but wouldn't rewriting all the URLs also work? That is, rather than ../feed, to just make it all absolute paths: /blog/feed/rss.xml?

@tbm
Copy link
Author

tbm commented Nov 20, 2020

Also, correct me if I am wrong but wouldn't rewriting all the URLs also work? That is, rather than ../feed, to just make it all absolute paths: /blog/feed/rss.xml

Sure, but the web site generator I use uses relative links.

Anyway, my workaround is --url-ignore /feed/ which works fine, but I think html-proofer should expand file paths (as you suggest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants