davidxmoody / metalsmith-broken-link-checker

Metalsmith plugin to check for internal broken links
MIT License
20 stars 15 forks source link

when checking a link, the module should add /index.html at the end of the link #20

Open oupala opened 5 years ago

oupala commented 5 years ago

After fixing a bug in another module (aymericbeaumet/metalsmith-redirect#19), we discovered that metalsmith broken-link-checker could be improved to add /index.html add the end of a link when checking if it does exist.

So in the end, it looks like there is a bug in metalsmith-broken-link-checker as we would expect it to apply a fallback strategy where it would try appending /index.html to every link which looks like a directory (path.extname(link) === '' in a web environment).

You can check and reproduce the test case here.

oupala commented 5 years ago

Hi @davidxmoody,

Do you think you'll have time to add this feature so that metalsmith-broken-link-checker has a more reliable way to check broken links?

oupala commented 4 years ago

I've tried to use metalsmith-broken-link-checker with either metalsmith-redirect and metalsmith-aliases and they are not compatible (I mean metalsmith-broken-link-checker is not compatible with both of these plugins).

metalsmith-broken-link-checker is detecting false positive case where the broken link is due to the redirection by one of the redirection plugin.

A fix has been proposed by @aymericbeaumet and I am providing a test case to check if the fix is working (see above).