Skip to content
Snippets Groups Projects
Verified Commit befd05a0 authored by Jake's avatar Jake
Browse files

fixed tags not working

parent 39ff7724
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,8 @@ class Page: ...@@ -50,7 +50,8 @@ class Page:
# tags # tags
self.tags = [] self.tags = []
if 'tags' in metadata: if 'tags' in metadata:
for t in metadata['tags']: tags = self.tags_str_to_list(metadata['tags'])
for t in tags:
if (t != category): if (t != category):
self.tags.append(t) self.tags.append(t)
self.tags.append(self.category) # the category is also a default tag self.tags.append(self.category) # the category is also a default tag
...@@ -64,6 +65,19 @@ class Page: ...@@ -64,6 +65,19 @@ class Page:
# url # url
self.url = self.lang + '/' + self.category + '/' + self.slug + ".html" self.url = self.lang + '/' + self.category + '/' + self.slug + ".html"
def tags_str_to_list(self, s):
res = []
l = s.split(',')
for t in l:
t = t.lower()
t = t.lstrip()
t = t.rstrip()
if len(t) > 0:
res.append(t)
return res
def __lt__(self, other): def __lt__(self, other):
return self.date_modified < other.date_modified return self.date_modified < other.date_modified
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment