Skip to content

Remove global elements from search result snippets

Sarah German requested to merge google-snippets into main

What does this MR do and why?

Adds a data-nosnippet attribute to sections of the page templates that should not be included in Google search result snippets:

  • Global nav
  • Help & Feedback footer
  • Footer nav

This should improve results shown on a query like this: https://gps-rc-1.docs.gitlab-review.app/search/?q=scss (many items are just showing content from the global nav). The issue is also visible on a regular Google search: https://www.google.com/search?q=scss+site%3Adocs.gitlab.com

Note that it will take a few days for this change get picked up by Google's crawler.

Google reference: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#nosnippet

Closes: #1593

Screenshots, screen recordings, or links to review app

https://google-snippets.docs.gitlab-review.app/

How to set up and validate locally

We won't be able to fully validate this until Google re-crawls the site, but you can see the markup if you inspect HTML source on the review app:

Global nav Feedback box Footer
image image image

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