diff --git a/scripts/blog.py b/scripts/blog.py index 36e4a36..eb1b440 100644 --- a/scripts/blog.py +++ b/scripts/blog.py @@ -122,6 +122,7 @@ def slugify(title): slug = unidecode(title).lower() slug = SLUG_REMOVE_RE.sub('', slug) slug = SLUG_HYPHENATE_RE.sub('-', slug) + slug = slug.strip('-') return slug.strip() @@ -167,7 +168,7 @@ def get_out_path(front_matter): out_path = os.path.join(str(front_matter['date'].year), front_matter['slug']) if front_matter.get('lang', LANG_PRIORITY[0]) != LANG_PRIORITY[0]: - out_path = os.path.join(str(front_matter['date'].year), front_matter['lang'], front_matter['slug']) + out_path = os.path.join(front_matter['lang'], str(front_matter['date'].year), front_matter['slug']) return out_path @@ -388,7 +389,7 @@ def render_categories(docs, dest_top): result = CATEGORY_LIST_TEMPLATE.render( posts=posts, ) - path = os.path.join(dest_top, "tags", tag, "index.html") + path = os.path.join(dest_top, "tags", tag.replace('/', '_'), "index.html") os.makedirs(os.path.dirname(path), exist_ok=True) with open(path, 'wt') as f: f.write(result) diff --git a/static/article.tmpl.html b/static/article.tmpl.html index 6383710..d4a02c1 100644 --- a/static/article.tmpl.html +++ b/static/article.tmpl.html @@ -38,7 +38,7 @@ diff --git a/static/article_list.tmpl.html b/static/article_list.tmpl.html index 0e52252..0618924 100644 --- a/static/article_list.tmpl.html +++ b/static/article_list.tmpl.html @@ -42,7 +42,7 @@
diff --git a/static/blog_index.tmpl.html b/static/blog_index.tmpl.html index b1939c7..3bc6d8f 100644 --- a/static/blog_index.tmpl.html +++ b/static/blog_index.tmpl.html @@ -40,7 +40,7 @@ diff --git a/static/category_list.tmpl.html b/static/category_list.tmpl.html index 893b5a3..1b19771 100644 --- a/static/category_list.tmpl.html +++ b/static/category_list.tmpl.html @@ -42,7 +42,7 @@