forked from github.com/blag
fixed bug so empty tags don't throw an error
This commit is contained in:
@@ -392,7 +392,7 @@ def generate_tags(articles, tags_template, tag_template, output_dir):
|
|||||||
# get tags number of occurrences
|
# get tags number of occurrences
|
||||||
all_tags = {}
|
all_tags = {}
|
||||||
for _, context in articles:
|
for _, context in articles:
|
||||||
tags = context.get('tags', None)
|
tags = context.get('tags', [])
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
all_tags[tag] = all_tags.get(tag, 0) + 1
|
all_tags[tag] = all_tags.get(tag, 0) + 1
|
||||||
# sort by occurrence
|
# sort by occurrence
|
||||||
@@ -405,7 +405,7 @@ def generate_tags(articles, tags_template, tag_template, output_dir):
|
|||||||
# get tags and archive per tag
|
# get tags and archive per tag
|
||||||
all_tags = {}
|
all_tags = {}
|
||||||
for dst, context in articles:
|
for dst, context in articles:
|
||||||
tags = context.get('tags', None)
|
tags = context.get('tags', [])
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
archive = all_tags.get(tag, [])
|
archive = all_tags.get(tag, [])
|
||||||
entry = context.copy()
|
entry = context.copy()
|
||||||
|
|||||||
Reference in New Issue
Block a user