Skip to content

Override gitlab-docs-section tag for tutorial pages

Sarah German requested to merge 1713-tutorials-search-tags into main

What does this MR do and why?

Sets the gitlab-docs-section metatag to "Tutorials" for pages that have a title that starts with Tutorial:.

Normally the gitlab-docs-section metatag is set based on the top-level parent page in the global navigation. Tutorials are located in sections related to their content, though, and we want to classify these pages as Tutorials in order to better surface them in search. So for these, we can override the section tag based on the title.

Note that we're using the <h1> title set on the markdown file for this, not the title from in navigation.yaml (generally these are the same, but not 100%).

In a follow-up MR, we'll add a "Tutorials" checkbox to "Filter by" on the search results page.

Step 1 of 2 to close #1713 (closed).

Screenshots, screen recordings, or links to review app

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Find a tutorial page that is located outside of the "Tutorials" area of the global navigation, such as:
  1. Inspect the page source and check that the gitlab-docs-section metatag is set to Tutorials.

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