Skip to content

Docs: Add docs-check-links target#1546

Open
TomFern wants to merge 3 commits into
masterfrom
docs/check-links
Open

Docs: Add docs-check-links target#1546
TomFern wants to merge 3 commits into
masterfrom
docs/check-links

Conversation

@TomFern

@TomFern TomFern commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

We have a check-links target in the vmdocs repository. This is a good start but it only detects broken links after changes in docs are merged into master in this repository.

It would be nice to have a way to check the documentation in this repository (before creating a PR for instance). This PR introduces a docs-check-links target to the docs/Makefile. This lets us see if we have any new broken links in the current branch/PR before merging into main.

We've already implemented this on VictoriaMetrics here: VictoriaMetrics/VictoriaMetrics#11121

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@TomFern TomFern changed the title Add docs-check-links target Docs: Add docs-check-links target Jun 25, 2026
@TomFern TomFern added the documentation Improvements or additions to documentation label Jun 25, 2026
Comment thread docs/Makefile Outdated
Comment on lines +88 to +98
docs-check-links: docs-image
rm -rf $(PWD)/docs/public
docker run \
--rm \
--platform $(DOCKER_PLATFORM) \
-v $(PWD)/docs/victorialogs:/opt/docs/content/victorialogs \
-v $(PWD)/docs/public:/opt/docs/public \
--entrypoint /bin/sh \
vmdocs-docker-package \
-c "yarn install && hugo --minify && yarn run check-links"
rm -rf $(PWD)/docs/public

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how it works, but it generates quite false positives. This solution seems fragile to me. It should work without noise and be reliable in order to be useful.

$ linkinator .
→ crawling .
[#] victoriametrics/stream-aggregation/#data-delay-and-staleness
[0] http://scout.docker.com/v/CVE-2025-61729
[0] http://www.haproxy.org/
[0] http://localhost:8428/vmui/
[0] http://localhost:9428/select/vmui
[#] helm/victoriametrics-k8s-stack/changelog/#v0850
[#] helm/victoriametrics-k8s-stack/changelog/#v0850
[#] victoriametrics-cloud/get-started/quickstart/#about-storage
[#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
[#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
[0] http://scout.docker.com/v/CVE-2025-61729
[0] http://scout.docker.com/v/CVE-2025-61729
[0] http://scout.docker.com/v/CVE-2025-61729
[0] http://scout.docker.com/v/CVE-2025-61729
[#] http://docs.grafana.org/administration/provisioning/#datasources
./
  [#] victoriametrics/stream-aggregation/#data-delay-and-staleness
  [#] victoriametrics-cloud/get-started/quickstart/#about-storage
  [#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
  [#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
changelog/
  [0] http://scout.docker.com/v/CVE-2025-61729
victoriametrics/integrations/grafana/datasource/
  [#] http://docs.grafana.org/administration/provisioning/#datasources
victoriametrics/changelog/changelog_2026/
  [0] http://scout.docker.com/v/CVE-2025-61729
victoriametrics/changelog/changelog_2025/
  [0] http://scout.docker.com/v/CVE-2025-61729
victoriametrics/changelog/changelog_2022/
  [0] http://www.haproxy.org/
guides/getting-started-with-opentelemetry/
  [0] http://localhost:8428/vmui/
  [0] http://localhost:9428/select/vmui
helm/victoria-metrics-k8s-stack/
  [#] helm/victoriametrics-k8s-stack/changelog/#v0850
  [#] helm/victoriametrics-k8s-stack/changelog/#v0850
victoriametrics/changelog/
  [0] http://scout.docker.com/v/CVE-2025-61729
changelog.html
  [0] http://scout.docker.com/v/CVE-2025-61729
ERROR: Detected 15 broken links. Scanned 650 links in 33.718 seconds.

@TomFern TomFern Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds the hugo site by cloning vmdocs and overwriting the docs folders in this repository. Then it uses linkinator to scan the whole site. So it picks up issues across all documentation, not just VictoriaLogs.

The lines with [#] mean there is a broken anchor. That is, the link works but there is no matching anchor in the page.

The lines with [0] mean the link is broken. In this case I think there could have been a network error on some of the external site. I think we should disable all link checking to external sites. I'll check the config file on vmdocs to see how to disable it.

The correct list of issues should be this (I also need to exclude localhost from the scan)

./
  [#] victoriametrics/stream-aggregation/#data-delay-and-staleness
  [#] victoriametrics-cloud/get-started/quickstart/#about-storage
  [#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
  [#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
victoriametrics/integrations/grafana/datasource/
  [#] http://docs.grafana.org/administration/provisioning/#datasources
victoriametrics/query-stats/
  [#] victoriametrics/style_guide/#proofreading-tools
victoriametrics/style_guide/
  [0] http://docs.vicoriametrics.com/victoriametrics/data-ingestion/opentelemetry-collector/
guides/getting-started-with-opentelemetry/
  [0] http://localhost:8428/vmui/
  [0] http://localhost:9428/select/vmui
helm/victoria-metrics-k8s-stack/
  [#] helm/victoriametrics-k8s-stack/changelog/#v0850
  [#] helm/victoriametrics-k8s-stack/changelog/#v0850
ERROR: Detected 11 broken links. Scanned 653 links in 32.323 seconds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining. Yes, please go ahead. It's probably better to note in the make command that this excludes external sites and only checks inbound links.

Could we set it up to report on VictoriaLogs only since the PR intention is "check the documentation in this repository"?

Also when I run this command, it creates a docs/public/ dir, which makes the git changes on my local dirty with unrelated changes. It would be great to either remove it or move it to /tmp or any folder that gets ignored.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll make the changes. Thanks for the feedback. The config is global for all docs because the config files lives in vmdocs. I want to add a docs-check-link target in every repository (VM, VL, VT, etc) that has docs, so we can one day add some automation check in all PRs that deal with docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added the same checker on VT here: VictoriaMetrics/VictoriaTraces#194

Let me update the config file first and then see if that clears the issues

@TomFern

TomFern commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@func25 I updated the link checker config in this PR. Once merged, the new config should take effect for all repositories using the link checker tool. (Update: it has been merged)

I also updated the docs/Makefile to do the cleanup even if the checker fails. Previously, when the docker command failed due to broken links, the last line which deleted docs/public was never executed. It should do the cleanup now regardless of success or failure.

The correct output of the link checker should now be (once the PR above is merged)

./
  [#] victoriametrics/stream-aggregation/#data-delay-and-staleness
  [#] victoriametrics-cloud/get-started/quickstart/#about-storage
  [#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
  [#] victoriametrics-cloud/alertmanager-setup-for-deployment/#configure-alerting-rules
helm/victoria-metrics-k8s-stack/
  [#] helm/victoriametrics-k8s-stack/changelog/#v0850
  [#] helm/victoriametrics-k8s-stack/changelog/#v0850
ERROR: Detected 6 broken links. Scanned 626 links in 29.335 seconds.

I checked and they all seem legitimate broken anchors. Here's the report:

Broken anchor File Line(s)
#data-delay-and-staleness content/victoriametrics/stream-aggregation/README.md 648, 650
#v0850 content/helm/victoria-metrics-k8s-stack/_index.md (via available_from shortcode) 221, 301
#about-storage content/victoriametrics-cloud/get-started/quickstart.md 66, 67
#configure-alerting-rules content/victoriametrics-cloud/get-started/features.md 62

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/Makefile">

<violation number="1" location="docs/Makefile:101">
P1: The `exit` command in the `docs-check-links` target never executes — it becomes an argument to `rm -rf`. After a link-check failure, `make docs-check-links` exits with code 0 instead of propagating the failure, so CI or pre-merge hooks won't detect broken links. The fix is a missing `;` (or `&&`) before `exit` to separate it from `rm -rf` as an independent command.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/Makefile Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Signed-off-by: Pablo (Tomas) Fernandez <46322567+TomFern@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants