Gatsby: Add link checker for Gatsby Docs

Created on 5 Nov 2019  路  26Comments  路  Source: gatsbyjs/gatsby

Summary

There is a plugin for a remark Link check: https://www.gatsbyjs.org/packages/gatsby-remark-check-links/

Can this also work on the Gatsby docs/Blog?

Or as a PR check?

new edit:

Ideas

  • check local links

    • add a linter to check before it is submitted
    • check if it has a local domain name (A lint rule is WIP)
    • check if local domains begin with a ., .. or /
    • allow local domain and remove local domain on build time with a transformer
  • check local anchors

    • with a linter and analyse each linked file?
    • on gatsby develop/gatsby build via a graphql query to query all headers?
  • check internal links for trailing slashes (because breadcrumbs and selected sidebar is depend on it)

    • check with linter
  • check external links

    • HEAD request
    • with blc (broken link checker)
  • check internal link files (like doc-links.yml, redirects.yml)

    • with a link checker script (like site showcase validator)

possible tools

help wanted not stale documentation

All 26 comments

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

any opinion about this?

as seen in the linked issues there some places where 404 exists without any notification when a PR is done...

closing #18908 as duplicate of this Issue.
copy some comments from duplicate

Summary

It would be nice to have some link check on the gatsbyjs.org site maybe as validator while an PR or better also on gatsby develop to find old broken links

Caveeats

I know we can not find and check all links because some are generated from sourced data.

Motivation

During Hacktoberfest I see also some broken links reported. Example #18905

It would be nice to avoid broken links from beginning.

note

I don't mean the broken links reported for viewing files on github

_Originally posted by @muescha in https://github.com/gatsbyjs/gatsby/issues/18908#issue-510606085_

Maybe putting something like Hyperlink into a GitHub Action could be a good solution to this so it would run similar to how the site showcase validator works right now.

_Originally posted by @lannonbr in https://github.com/gatsbyjs/gatsby/issues/18908#issuecomment-544929178_

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

it should also check the anchor links to headers

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

there should also an internal anchor link checker for headings.

see:

21061 fix (www) additional links to "install nodejs"

20762 fix(www) - Fix anchor link in tutorial sidebar

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

helpful to find this errors:

  • #22461 update link to json section

the checker should also check if all pages are in the TOC files for the sections. for example in www/src/data/sidebars/doc-links.yaml

related issue:

  • #22923 fix(docs): Adding a Redux Store to TOC

the checker should also check if all pages are in the TOC files for the sections. for example in www/src/data/sidebars/doc-links.yaml

I don't think this needs to be part of it, since there could be times when we don't want to list a page in the TOC (for example, if it's linked elsewhere and not meant to be a highly prioritized page).

I found these two potential packages:

I've also tagged this issue with topic: website, since it could be added as part of the website redesign project.

link checker should also check if internal links are having trainling slashes because breadcrumbs and selected sidebar is depend on it:

  • #20767 [docs] Breadcrumb shouldn't be dependent on trailing slash
  • #21318 fix(www): Add slashes to links in features overview
  • #21604 docs: redirect not select TOC

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

25469 Docs links that start with docs/ rather than /docs/

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Not stale

FYI for root-relative links with remark-validate-links I have opened an issue for that here: https://github.com/remarkjs/remark-validate-links/issues/57

I ended up taking https://npmjs.com/package/mdx-link-checker and modifying it:

  1. now handles href, to, src props
  2. matches name as well as id for anchor checking
  3. adds index.mdx if linking to a directory
  4. check root relative links by passing in a base directory
  5. now has an ignore glob

I will open source this in the coming days / weeks.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Not stale

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Not stale

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Not stale

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theduke picture theduke  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

rossPatton picture rossPatton  路  3Comments

benstr picture benstr  路  3Comments

brandonmp picture brandonmp  路  3Comments