Skip to content

Commit 254ee97

Browse files
committed
Updated distribution files
1 parent 04f177c commit 254ee97

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

material/plugins/tags/plugin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ def on_page_markdown(self, markdown, page, config, files):
9797
return self._render_tag_index(markdown)
9898

9999
# Add page to tags index
100-
for tag in page.meta.get("tags", []):
101-
self.tags[tag].append(page)
100+
tags = page.meta.get("tags", [])
101+
if tags:
102+
for tag in tags:
103+
self.tags[tag].append(page)
102104

103105
# Inject tags into page (after search and before minification)
104106
def on_page_context(self, context, page, config, nav):
@@ -110,7 +112,8 @@ def on_page_context(self, context, page, config, nav):
110112
return
111113

112114
# Provide tags for page
113-
if "tags" in page.meta:
115+
context["tags"] =[]
116+
if "tags" in page.meta and page.meta["tags"]:
114117
context["tags"] = [
115118
self._render_tag(tag)
116119
for tag in page.meta["tags"]

0 commit comments

Comments
 (0)