Skip to content

Add migration script for index.md links

Sarah German requested to merge 62-update-index-links into main

What does this MR do and why?

Adds a script to update markdown links that reference index.md pages.

For Hugo, they need to point to _index.md instead. We already rename index files on build to _index.md (from here); this MR just fixes links that point to them.

Relates to #62 (closed)

How to set up and validate locally

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo/-/blob/main/doc/setup.md.
  2. Checkout this branch
  3. Fetch up-to-date content, but don't run any migrations: REMOVE_BEFORE_CLONE=true go run cmd/gldocs/main.go clone
  4. Run this migration only: go run cmd/gldocs/main.go migrate indexLinks ../gitlab/doc
  5. View the diff: git -C ../gitlab diff

Expected result: Relative markdown links to index.md files now point to _index.md, like this:

Before:

this is a sentence with an [index page](../index.md) link

After:

this is a sentence with an [index page](../_index.md) link

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports