Only display tags on serve #8110
-
Hi! I am just now beginning to use tags, so I might be missing something, but my goal is:
I think I'm essentially asking to treat all tags as shadow tags without needing special notation. Is there a way to do this with the current settings? I'm also exploring if I can set |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi :) Yes, this is doable. mkdocs supports environment variables for config values, so you can do something like this: plugins:
- tags:
tags: !ENV [SHOW_TAGS,false] and invoke SHOW_TAGS=true mkdocs serve This way, tags won't be rendered unless you explicitly define |
Beta Was this translation helpful? Give feedback.
-
@mocdaniel Thank you! That's super helpful. It does make me realize that I worded my question backwards - my goal is more to suppress tags upon building so that running just Would the same principle apply where I'd run something like |
Beta Was this translation helpful? Give feedback.
Exactly :) just make sure to flip the default in your
mkdocs.yaml
fromfalse
totrue
, then pass the env variable in your build scenario as you outlined already.That way, tags will always shop up when your site is served directly by mkdocs, but won't be displayed when the site's build is being served (e.g. by a web server in production).