Improved resilience of tags plugin (#7098)
This commit is contained in:
parent
bde889fab1
commit
04f177cbd4
|
|
@ -97,7 +97,9 @@ class TagsPlugin(BasePlugin[TagsConfig]):
|
||||||
return self._render_tag_index(markdown)
|
return self._render_tag_index(markdown)
|
||||||
|
|
||||||
# Add page to tags index
|
# Add page to tags index
|
||||||
for tag in page.meta.get("tags", []):
|
tags = page.meta.get("tags", [])
|
||||||
|
if tags:
|
||||||
|
for tag in tags:
|
||||||
self.tags[tag].append(page)
|
self.tags[tag].append(page)
|
||||||
|
|
||||||
# Inject tags into page (after search and before minification)
|
# Inject tags into page (after search and before minification)
|
||||||
|
|
@ -110,7 +112,8 @@ class TagsPlugin(BasePlugin[TagsConfig]):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Provide tags for page
|
# Provide tags for page
|
||||||
if "tags" in page.meta:
|
context["tags"] =[]
|
||||||
|
if "tags" in page.meta and page.meta["tags"]:
|
||||||
context["tags"] = [
|
context["tags"] = [
|
||||||
self._render_tag(tag)
|
self._render_tag(tag)
|
||||||
for tag in page.meta["tags"]
|
for tag in page.meta["tags"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue