diff --git a/material/plugins/tags/config.py b/material/plugins/tags/config.py index 763581e56..a1d4f1e2d 100644 --- a/material/plugins/tags/config.py +++ b/material/plugins/tags/config.py @@ -34,6 +34,7 @@ class TagsConfig(Config): enabled = Type(bool, default = True) # Settings for tags + tags = Type(bool, default = True) tags_file = Optional(Type(str)) tags_extra_files = Type(dict, default = {}) tags_slugify = Type((type(slugify), partial), default = slugify) diff --git a/material/plugins/tags/plugin.py b/material/plugins/tags/plugin.py index beafd5fb4..e5ce6bdec 100644 --- a/material/plugins/tags/plugin.py +++ b/material/plugins/tags/plugin.py @@ -44,6 +44,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Initialize tags self.tags = defaultdict(list) self.tags_file = None @@ -66,6 +70,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Resolve tags index page file = self.config.tags_file if file: @@ -76,6 +84,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Skip, if page is excluded if page.file.inclusion.is_excluded(): return @@ -93,6 +105,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Provide tags for page if "tags" in page.meta: context["tags"] = [ diff --git a/src/plugins/tags/config.py b/src/plugins/tags/config.py index 763581e56..a1d4f1e2d 100644 --- a/src/plugins/tags/config.py +++ b/src/plugins/tags/config.py @@ -34,6 +34,7 @@ class TagsConfig(Config): enabled = Type(bool, default = True) # Settings for tags + tags = Type(bool, default = True) tags_file = Optional(Type(str)) tags_extra_files = Type(dict, default = {}) tags_slugify = Type((type(slugify), partial), default = slugify) diff --git a/src/plugins/tags/plugin.py b/src/plugins/tags/plugin.py index beafd5fb4..e5ce6bdec 100644 --- a/src/plugins/tags/plugin.py +++ b/src/plugins/tags/plugin.py @@ -44,6 +44,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Initialize tags self.tags = defaultdict(list) self.tags_file = None @@ -66,6 +70,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Resolve tags index page file = self.config.tags_file if file: @@ -76,6 +84,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Skip, if page is excluded if page.file.inclusion.is_excluded(): return @@ -93,6 +105,10 @@ class TagsPlugin(BasePlugin[TagsConfig]): if not self.config.enabled: return + # Skip if tags should not be built + if not self.config.tags: + return + # Provide tags for page if "tags" in page.meta: context["tags"] = [