From 8efd38c7a9588cb48b4d4bdb0c1635449865fe69 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 22 Sep 2024 19:35:45 -0400 Subject: [PATCH] Use anchorlinks rather than permalinks (#7626) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Unfortunately, the permalinks show up in the SERPs as part of the title: ![Screenshot 2024-09-22 at 3 08 54 PM](https://github.com/user-attachments/assets/6914af46-35bd-4d53-8a57-fbba21a0f7e9) Instead, we'll just make the headers themselves links. Before: ![Screenshot 2024-09-22 at 3 08 03 PM](https://github.com/user-attachments/assets/9e354fca-d319-4779-b38a-05daee530608) ![Screenshot 2024-09-22 at 3 08 06 PM](https://github.com/user-attachments/assets/954af6b5-35cd-4519-815f-24555b6ba086) After: ![Screenshot 2024-09-22 at 3 08 19 PM](https://github.com/user-attachments/assets/90c84012-778d-440d-9028-2b40d86ad53c) ![Screenshot 2024-09-22 at 3 08 17 PM](https://github.com/user-attachments/assets/8add8f41-4030-4bbf-9acd-e6027e3f6cda) I prefer what we had before visually, but the SEO hit is bad enough that I want to change it. --- docs/stylesheets/extra.css | 9 +++++++++ mkdocs.template.yml | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index 1a2956f165fb..8e2b9b9f5475 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -186,3 +186,12 @@ h3.cli-reference { font-size: 1.1em; margin: 0 0 0 0; } + +/* Styling for anchor link headers */ +.toclink { + color: unset !important; +} + +.toclink:hover { + color: var(--md-accent-fg-color) !important; +} diff --git a/mkdocs.template.yml b/mkdocs.template.yml index 6e40ea25c74c..cf14bd2bafe2 100644 --- a/mkdocs.template.yml +++ b/mkdocs.template.yml @@ -42,11 +42,12 @@ site_dir: site/uv markdown_extensions: - admonition - pymdownx.details - - toc: - permalink: "#" - pymdownx.snippets: - pymdownx.magiclink: - attr_list: + - toc: + anchorlink: true + anchorlink_class: "toclink" - md_in_html: - pymdownx.inlinehilite: - pymdownx.superfences: