Skip to content

Tags rework#1305

Draft
CallumWalley wants to merge 6 commits into
mainfrom
tags-rework
Draft

Tags rework#1305
CallumWalley wants to merge 6 commits into
mainfrom
tags-rework

Conversation

@CallumWalley

@CallumWalley CallumWalley commented Jun 18, 2026

Copy link
Copy Markdown
Member

Something i'd been meaning to do for a while.

Tags are in theory used for two things, SEO and as a secondry navigation.

The secondry navigation I had turned off because the tags were too rubbish, and fragmented do be worth displaying.

This change aims to fix that.

  • Added list of 'approved' tags.
  • Linter should now tell you off.
  • added pages_with_tag() macro.
  • Deleted rubbish tags and consolidated aliases.

Using tags as context and secondry navigation

image image

Also allows need things like

## Application and toolbox specific support pages

{% for p in pages_with_tag("gpu") %}
- [{{ p.title }}]({{ p.path }})
{% endfor %}

@CallumWalley CallumWalley marked this pull request as draft June 18, 2026 02:36

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Ahoy, ye tag-wrangling scallywags! This massive haul of a pull request sets to scuttle the chaotic tags of old and replace 'em with a shiny new canonical tag vocabulary, complete with a fancy pages_with_tag macro in macro_hooks.py to dynamically link pages. While this clean-up be a fine wind in our sails, ye've managed to steer straight into some shallow waters: yer macro will have pages linkin' to themselves and break on Windows build machines due to backslash path separators, and ye left a lying comment in mkdocs.yml claiming tags won't display when ye just set 'em to true. Patch up these leaks before ye run this ship aground!

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread macro_hooks.py
Comment on lines +29 to +38
def pages_with_tag(tag):
entries = tag_index.get(tag.lower(), [])
try:
current_dir = os.path.dirname(env.page.file.src_path)
except AttributeError:
return entries
return [
{"title": e["title"], "path": os.path.relpath(e["path"], current_dir)}
for e in entries
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Ahoy, matey! I spy two major snags in this macro that'll run yer ship aground:

  1. Self-Referencing Links: A page tagg'd with gpu (like Using_GPUs.md) will end up linkin' to itself, makin' a useless loop! We should filter out the current page (env.page.file.src_path).
  2. Windows Path Separators: os.path.relpath will use backslashes on Windows build machines, which breaks the links in the browser. Ye must replace them backslashes with proper forward slashes (/).

Here be a cleaner, sturdier version of the macro to keep yer links sailin' true!

Suggested change
def pages_with_tag(tag):
entries = tag_index.get(tag.lower(), [])
try:
current_dir = os.path.dirname(env.page.file.src_path)
except AttributeError:
return entries
return [
{"title": e["title"], "path": os.path.relpath(e["path"], current_dir)}
for e in entries
]
def pages_with_tag(tag):
entries = tag_index.get(tag.lower(), [])
try:
current_src = env.page.file.src_path
current_dir = os.path.dirname(current_src)
except AttributeError:
return entries
return [
{"title": e["title"], "path": os.path.relpath(e["path"], current_dir).replace(os.path.sep, "/")}
for e in entries
if e["path"] != current_src
]

Comment thread mkdocs.yml
# - git-authors
- tags:
tags: false # This will keep tags for the purpose of indexing, but not display on page.
tags: true # This will keep tags for the purpose of indexing, but not display on page.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Shiver me timbers! Ye changed tags to true, but left the comment claimin' it won't display them on the page! That comment be tellin' tall tales now. Update or scuttle that comment so future sailors don't get confused!

      tags: true  # This will display tags on the page and keep them for indexing.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Test deployment successful!! (2026-06-18T05:04:45Z)
Preview available at https://callumwalley.github.io/mkdocs-demo-deploy/nesi/support-docs/tags-rework

Seems the following pages differ;



See all deployed demo sites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants