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

Make all internal broken links red #3799

Closed
hamishwillee opened this issue May 14, 2021 · 4 comments · Fixed by #3815
Closed

Make all internal broken links red #3799

hamishwillee opened this issue May 14, 2021 · 4 comments · Fixed by #3815
Assignees

Comments

@hamishwillee
Copy link
Contributor

Currently links created with one of the xref macros are marked in red if the target page does not exist. This is great for authors because it tells us that there is some content that needs to be written, and it is great for other readers, because they don't waste time following links to 404 errors.

IMO it is always better to be shown a red link for ANY broken internal links - not just macros - for the same reasons. It really doesn't matter why it is broken, I never want to navigate away from my reading context to something I could know in advance does not exist.

This might help with problems like: mdn/content#4922

This continues discussion from mdn/content#4570 (comment)

@peterbe
Copy link
Contributor

peterbe commented May 17, 2021

I actually like this! It's silly to present a link to a page that doesn't exist, and just going to lead to a 404 Page Not Found.
However, here's how the red links are created from smartLink() inside KS macros:

<a class="page-not-created" title="The documentation about this has not yet been written; please consider contributing!">
  <code>for each...in</code>
</a>

(from this page)

Can we think up a better tooltip text for that? Perhaps something that covers us from the fact that perhaps it used to work but has since become broken.

My "fear" is that someone sees that and starts to create the page and doesn't realize it already exists but the link was badly pointed.

Truth be told, perhaps the tooltip could be something we only bother with in Kumascript macros. But for all other internal links that won't work we just make them un-clickable and red without a tooltip.

@peterbe
Copy link
Contributor

peterbe commented May 17, 2021

We chatted about this in the weekly Editorial meeting and at least 3 people said "Yes!" to this.
Much better to do a red un-clickable link rather than a link that'll just lead to sadness. E.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter

@peterbe peterbe self-assigned this May 17, 2021
peterbe added a commit to peterbe/yari that referenced this issue May 17, 2021
@wbamberg
Copy link
Collaborator

It seems like there are a couple of things in here:

  1. make links to nonexistent pages red (say) and unclickable
  2. have a tooltip saying something like "The documentation about this has not yet been written; please consider contributing"

I can't see any downside to (1) but (2) is tricky because it will confuse people when the link is wrong or is pointing to a page we deleted. On the other hand that's already a problem for macro-generated links, and I agree it seems totally arbitrary to do it one way for macro-generated links, and the other way for plain links.

@peterbe
Copy link
Contributor

peterbe commented May 17, 2021

It seems like there are a couple of things in here:

1. make links to nonexistent pages red (say) and unclickable

2. have a tooltip saying something like "The documentation about this has not yet been written; please consider contributing"

I can't see any downside to (1) but (2) is tricky because it will confuse people when the link is wrong or is pointing to a page we deleted. On the other hand that's already a problem for macro-generated links, and I agree it seems totally arbitrary to do it one way for macro-generated links, and the other way for plain links.

The 1. problem is taken care of by #3815

But regarding 2., can you share some light on this question here: #3815 (comment)

The easiest thing would be to just do nothing (i.e. no tooltip for the broken links) but now's the good time to deal with it while our brains are active on this subject.

schalkneethling pushed a commit that referenced this issue May 24, 2021
* Make all internal broken links red

Fixes #3799

* take Hamish's suggestion plus test
peterbe added a commit to peterbe/yari that referenced this issue Jun 1, 2021
* Make all internal broken links red

Fixes mdn#3799

* take Hamish's suggestion plus test
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

Successfully merging a pull request may close this issue.

3 participants