Skip to content

Commit e3d5fd2

Browse files
committed
Added missing tags setting in tags plugin
1 parent 2a131ca commit e3d5fd2

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

material/plugins/tags/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class TagsConfig(Config):
3434
enabled = Type(bool, default = True)
3535

3636
# Settings for tags
37+
tags = Type(bool, default = True)
3738
tags_file = Optional(Type(str))
3839
tags_extra_files = Type(dict, default = {})
3940
tags_slugify = Type((type(slugify), partial), default = slugify)

material/plugins/tags/plugin.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def on_config(self, config):
4444
if not self.config.enabled:
4545
return
4646

47+
# Skip if tags should not be built
48+
if not self.config.tags:
49+
return
50+
4751
# Initialize tags
4852
self.tags = defaultdict(list)
4953
self.tags_file = None
@@ -66,6 +70,10 @@ def on_nav(self, nav, config, files):
6670
if not self.config.enabled:
6771
return
6872

73+
# Skip if tags should not be built
74+
if not self.config.tags:
75+
return
76+
6977
# Resolve tags index page
7078
file = self.config.tags_file
7179
if file:
@@ -76,6 +84,10 @@ def on_page_markdown(self, markdown, page, config, files):
7684
if not self.config.enabled:
7785
return
7886

87+
# Skip if tags should not be built
88+
if not self.config.tags:
89+
return
90+
7991
# Skip, if page is excluded
8092
if page.file.inclusion.is_excluded():
8193
return
@@ -93,6 +105,10 @@ def on_page_context(self, context, page, config, nav):
93105
if not self.config.enabled:
94106
return
95107

108+
# Skip if tags should not be built
109+
if not self.config.tags:
110+
return
111+
96112
# Provide tags for page
97113
if "tags" in page.meta:
98114
context["tags"] = [

src/plugins/tags/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class TagsConfig(Config):
3434
enabled = Type(bool, default = True)
3535

3636
# Settings for tags
37+
tags = Type(bool, default = True)
3738
tags_file = Optional(Type(str))
3839
tags_extra_files = Type(dict, default = {})
3940
tags_slugify = Type((type(slugify), partial), default = slugify)

src/plugins/tags/plugin.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def on_config(self, config):
4444
if not self.config.enabled:
4545
return
4646

47+
# Skip if tags should not be built
48+
if not self.config.tags:
49+
return
50+
4751
# Initialize tags
4852
self.tags = defaultdict(list)
4953
self.tags_file = None
@@ -66,6 +70,10 @@ def on_nav(self, nav, config, files):
6670
if not self.config.enabled:
6771
return
6872

73+
# Skip if tags should not be built
74+
if not self.config.tags:
75+
return
76+
6977
# Resolve tags index page
7078
file = self.config.tags_file
7179
if file:
@@ -76,6 +84,10 @@ def on_page_markdown(self, markdown, page, config, files):
7684
if not self.config.enabled:
7785
return
7886

87+
# Skip if tags should not be built
88+
if not self.config.tags:
89+
return
90+
7991
# Skip, if page is excluded
8092
if page.file.inclusion.is_excluded():
8193
return
@@ -93,6 +105,10 @@ def on_page_context(self, context, page, config, nav):
93105
if not self.config.enabled:
94106
return
95107

108+
# Skip if tags should not be built
109+
if not self.config.tags:
110+
return
111+
96112
# Provide tags for page
97113
if "tags" in page.meta:
98114
context["tags"] = [

0 commit comments

Comments
 (0)