Skip to content
Snippets Groups Projects
Commit 2d96be28 authored by Nikos Roussos's avatar Nikos Roussos
Browse files

Use slug for making post directory

parent 453107f3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -62,6 +62,7 @@ def generate_posts():
headers, content = raw.split('---', 1)
headers = yaml.load(headers)
tags = headers['tags'].split(', ')
slug = headers['slug']
md = Markdown()
content = md.convert(content)
 
Loading
Loading
@@ -77,7 +78,7 @@ def generate_posts():
 
shortdate = str.join('.', (year, month, day))
 
postpath = path.join(year, month, day)
postpath = path.join(year, month, day, slug)
try:
makedirs(postpath)
except OSError:
Loading
Loading
@@ -88,7 +89,8 @@ def generate_posts():
for file in files:
copy2(path.join('posts/files/', file), postpath)
 
filename = '{0}/{1}.html'.format(postpath, headers['slug'])
link = '{0}/'.format(postpath)
filename = '{0}index.html'.format(link)
 
print('Generating HTML blog post at {0}...'.format(filename))
 
Loading
Loading
@@ -101,7 +103,7 @@ def generate_posts():
author=cfg['author'],
sitename=cfg['sitename'],
content=content,
link=filename
link=link
)
 
template = env.get_template('post.html')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment