Fix blog linking.
This commit is contained in:
parent
302ec0b764
commit
abfd4b16c5
@ -122,6 +122,7 @@ def slugify(title):
|
|||||||
slug = unidecode(title).lower()
|
slug = unidecode(title).lower()
|
||||||
slug = SLUG_REMOVE_RE.sub('', slug)
|
slug = SLUG_REMOVE_RE.sub('', slug)
|
||||||
slug = SLUG_HYPHENATE_RE.sub('-', slug)
|
slug = SLUG_HYPHENATE_RE.sub('-', slug)
|
||||||
|
slug = slug.strip('-')
|
||||||
|
|
||||||
return 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'])
|
out_path = os.path.join(str(front_matter['date'].year), front_matter['slug'])
|
||||||
if front_matter.get('lang', LANG_PRIORITY[0]) != LANG_PRIORITY[0]:
|
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
|
return out_path
|
||||||
|
|
||||||
|
|
||||||
@ -388,7 +389,7 @@ def render_categories(docs, dest_top):
|
|||||||
result = CATEGORY_LIST_TEMPLATE.render(
|
result = CATEGORY_LIST_TEMPLATE.render(
|
||||||
posts=posts,
|
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)
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
with open(path, 'wt') as f:
|
with open(path, 'wt') as f:
|
||||||
f.write(result)
|
f.write(result)
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</time>
|
</time>
|
||||||
<ul class="post-tags">
|
<ul class="post-tags">
|
||||||
{% for post_tag in post_tags %}
|
{% for post_tag in post_tags %}
|
||||||
<li class="post-tag"><a href="{{ base_path }}/tags/{{ post_tag }}/"</a>{{ post_tag }}</a></li>
|
<li class="post-tag"><a href="{{ base_path }}/tags/{{ post_tag |urlencode|replace('/', '_') }}/"</a>{{ post_tag }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
<div class="post-metadata">
|
<div class="post-metadata">
|
||||||
<ul class="post-tags">
|
<ul class="post-tags">
|
||||||
{% for post_tag in post.post_tags %}
|
{% for post_tag in post.post_tags %}
|
||||||
<li class="post-tag"><a href="../tags/{{ post_tag }}/"</a>{{ post_tag }}</a></li>
|
<li class="post-tag"><a href="../tags/{{ post_tag |urlencode|replace('/', '_') }}/">{{ post_tag }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
</time>
|
</time>
|
||||||
<ul class="post-tags">
|
<ul class="post-tags">
|
||||||
{% for post_tag in post.post_tags %}
|
{% for post_tag in post.post_tags %}
|
||||||
<li class="post-tag"><a href="tags/{{ post_tag }}/"</a>{{ post_tag }}</a></li>
|
<li class="post-tag"><a href="tags/{{ post_tag |urlencode|replace('/', '_') }}/"</a>{{ post_tag }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
<div class="post-metadata">
|
<div class="post-metadata">
|
||||||
<ul class="post-tags">
|
<ul class="post-tags">
|
||||||
{% for post_tag in post.post_tags %}
|
{% for post_tag in post.post_tags %}
|
||||||
<li class="post-tag"><a href="../../tags/{{ post_tag }}/"</a>{{ post_tag }}</a></li>
|
<li class="post-tag"><a href="../../tags/{{ post_tag |urlencode|replace('/', '_') }}/">{{ post_tag }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user