[tags plugin] [custom mod] tag_extra_files
tags have custom links to their own indexes
#5094
Replies: 1 comment
-
Thanks for suggesting. As you already noticed, there are several cases that render this change problematic, most of which that tags now need to be disjunct between extra files. This is also the reason why we haven't added this functionality yet. A better solution would be to add a little more multi-instance support, allowing the tags plugin to scope to specific pages or sections of your documentation, similar to the include/exclude privacy plugin's settings. Something like: plugins:
- tags:
tags_file: section-a/tags.md
tags_include:
- section-a/*
- tags:
tags_file: section-b/tags.md
tags_include:
- section-b/* Now, if you would use a tag called "Installation" on any page in plugins:
- tags:
tags_key: tags
tags_file: tags.md
- tags:
tags_key: categories
tags_file: categories.md You could then use:
Both proposals allow for cleaner cutting of tags, while keeping the implementation simple. That would be my proposal to move forward on this topic. |
Beta Was this translation helpful? Give feedback.
-
I've made an extension for tags inspired #3864
First things first: I'm not a programmer.
Description:
If any of tags are assigned to
tag_extra_files
index, their links to main index are overriden, by a link to their custom index.Flaws:
You have to be careful not to accidentally put, a tag in two indexes, because the link will be re-written by the last affiliation.
Code
Enable or disable by
mkdocs.yml
plugins setting:In
tags/plugin.py
(probably inside your python environment, not mkdocs folder from git*).And at the end of the code (between
# Add tag URL, if tags index is enabled
and# Return tag
:I didn't do a pull request because:
Maybe it will be useful for someone.
I'd love to know what you think.
Beta Was this translation helpful? Give feedback.
All reactions