Custom URLs based on front-matter, and custom anchor link IDs? #2354
Replies: 1 comment 1 reply
-
AFAIK that's not possible, because front matter is implemented through Metadata, a Markdown extension, which can't alter navigation. I guess it could be achievable through a plugin. Maybe consult the plugin wiki if there's already a plugin adding this behavior.
Custom labels are perfectly valid and I've used them with great success. The disclaimer which is placed under several plugin configuration settings is not saying that plugin or extension options/features which aren't listed won't work. It's just a notice that we cannot provide support for all possible combinations, as that would eat up too much of my spare time. My girlfriend is already complaining 😉 |
Beta Was this translation helpful? Give feedback.
-
Couple of questions...
Is it possible to use front-matter to define the URL of a doc? Or must it always derive from the file hierarchy? Didn't see anything in the MkDocs or Material for MkDocs documentation about this, but I apologize if I missed it. Trying to set up consistent URLs across languages, but maybe the way to do that is just use the same folder hierarchy no matter the language.
To specify my own anchor link for a header (and not use the auto-generated ID, which is based on the header's text), it looks like custom labels, with the Table of Contents extension might be the way to go. That said, am I reading the Material for MkDocs docs correctly—and this isn't officially supported? Is there another way to accomplish this? Trying to prevent anchor link text from changing between translations (I want the header itself to translate, but not its specific anchor ID/URL).
Both cases are driven by my reading of the recent "show and tell" about localization, which is wonderfully useful.
Thanks, such a great tool.
Beta Was this translation helpful? Give feedback.
All reactions