Rewrite markdown links to HTML
What does this MR do and why?
Adds a markdown render hook to rewrite links to .md
files as links to their corresponding HTML pages.
Hugo doesn't have anything built-in for this, but one of Hugo's maintainers has an example (https://github.com/bep/portable-hugo-links), which I mostly just copied over as-is.
The only modification I made here was to drop this: {{ if $isRemote }} target="_blank"{{ end }}
. We do not open links in new tabs (see Pajamas: https://design.gitlab.com/components/link#behavior).
Please note: Links to pages that end in index.md
do not work yet (e.g, the "issue tracker" link in the first paragraph of this page). This is because we have to rename all index.md
files to _index.md
to work with Hugo. While we are already renaming the files themselves, we're going to need to update all links accordingly. This is harder than it sounds, so I've created a follow-up here: #62 (closed). Also related: #55 (closed).
Closes #52 (closed)
Screenshots, screen recordings, or links to review app
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo/-/blob/main/doc/setup.md. -
Update your local content and run the site: REMOVE_BEFORE_CLONE=true make clone-docs-projects && make view
-
Visit a few pages and verify that links to other pages are functional (with the exception of links that end in index.md
, see note in description)
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.
-
I have evaluated the MR acceptance checklist for this merge request.