[+] Generate url name

This commit is contained in:
Hykilpikonna
2021-12-26 20:53:51 -05:00
parent 502d5384af
commit 6b36c2d1f7
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
* text=auto
+5 -1
View File
@@ -44,13 +44,17 @@ if __name__ == '__main__':
if 'title_image' in post and '/' not in post['title_image']:
post['title_image'] = 'content/images/' + post['title_image']
# Generate url-name
if 'url_name' not in post:
post['url_name'] = os.path.splitext(b)[0].replace(' ', '-')
post['content'] = md.strip()
posts.sort(key=lambda x: x['date'], reverse=True)
# Give every post an id based on index
for i, p in enumerate(posts):
p['id'] = i
p['id'] = len(posts) - i
# Count tags and categories
tags = Counter([t for p in posts for t in p['tags']])