framework icon indicating copy to clipboard operation
framework copied to clipboard

broken links should break the build

Open Fil opened this issue 1 year ago • 11 comments

  • is this an option? or an opt-in for some projects only?
  • the broken links detection didn't see that I was missing trailing slashes, can we fix that?

(ref #1729)

Fil avatar Oct 08 '24 14:10 Fil

Not sure if this this about broken links in pages. If it is, please consider support for red links, as mentioned in #1828.

I do see those red links flaying by when npm run build.

Martien avatar Nov 22 '24 15:11 Martien

I think red links make sense in a wiki context where you can click on the link to instantiate the page. But given that Framework is a static site generator and not a wiki, and hence there’s no way to edit the site or page when viewing the page, I think breaking the build is more appropriate than rendering stylized broken links.

mbostock avatar Nov 22 '24 16:11 mbostock

True. I was not thinking of being able to click on the link to instantiate the page, because the site is read-only for visitors.

Then again, I would like a visual clue about any broken links. At times, I know that I will create the page that a link refers to, and I don’t want to have to go back later and add that link. Foresight, if you will.

It feels natural for me to add a [[link]] here and there when writing a page. Just because I know that the realisation of that future page is around the corner.

Thanks again for your reply. And wishing you a good weekend, again.

Martien avatar Nov 22 '24 21:11 Martien

Having red links (for preview at least) and optionally breaking the build would give us the best of both worlds.

Fil avatar Nov 22 '24 21:11 Fil

I am interested to learn why broken links should break the build. What is the rationale? I mean, the author(s) of the site are responsible for its content, right?

Martien avatar Nov 25 '24 10:11 Martien

So that authors are aware of broken links.

mbostock avatar Nov 25 '24 18:11 mbostock

Right. But the authors can already be aware of broken links as they are listed during the build. This does not imply that the build must break, too, right?

Martien avatar Nov 25 '24 19:11 Martien

In typical builds, there are hundreds if not thousands of lines of output, so it can be easy to miss when a broken link is issued only as a warning. Furthermore with continuous integration/deployment, humans often don’t look at the output at all; we need an automated signal to notify authors when something is broken, rather than just another line of text. Furthermore, we want to prevent the broken site from being deployed, so that developers can fix the link before users see it.

mbostock avatar Nov 25 '24 19:11 mbostock

I agree.

But what if the ultimate responsible person – like a product manager or business owner – wants those broken links to be deployed, for whatever reason. Should there be an option to turn that on or off?

Enfin, I want to be careful with your time, so I’m happy to close the conversation. I understand what you are saying and I agree with it, yet see it as a partial solution to break the build.

Thanks again for your time and wish you a perfect day.

Martien avatar Nov 25 '24 21:11 Martien

Yes, we could provide a way to opt-out of this behavior. At a minimum, I expect using the rel="external" technique would work, as we already use that to opt-out of link normalization.

mbostock avatar Nov 25 '24 22:11 mbostock

As an additional option, remove the href attribute from red links (https://github.com/observablehq/framework/discussions/1858#discussioncomment-11437041).

Fil avatar Dec 02 '24 14:12 Fil