metalsmith-broken-link-checker icon indicating copy to clipboard operation
metalsmith-broken-link-checker copied to clipboard

should links to null url be warned?

Open oupala opened this issue 9 years ago • 3 comments

I discover that null links are reported to be broken:

Error: Link is broken: href: "", text: "dev for business", in file: business-web\index.html

In my opinion, null link are either invalid or valid. But they should not be considered as broken.

Don't you think?

As metalsmith-broken-link-checker is only checking internal links, a null link is neither internal neither external. It is just a null link.

oupala avatar Dec 10 '15 14:12 oupala

I'm not really sure what you mean by a null link. If a link is simply missing a href attribute completely then I think it won't render properly as a link in some browsers. A link with empty text will reload the page (which probably isn't what you want). The usual way to do it is with "#" or "javascript:void(0);" which should both be allowed by the link checker I think.

Could you give some more explanation?

davidxmoody avatar Dec 18 '15 15:12 davidxmoody

By null link, I mean a link whose href attribute is null: <a href="" alt="no desc" />

Such links are reported to be broken, but they are not!

oupala avatar Dec 18 '15 20:12 oupala

I agree with @davidxmoody that they should be errors, because usually you don't actually want to do that. But if you do, you can already add an exception like:

    .use(blc({
        allowRegex: /^$/,
    }))

and then links like <a href=""> will be allowed.

dumbmatter avatar Jan 23 '17 23:01 dumbmatter