Closed horstjens closed 3 years ago
That’s not a conf.py
setting, but you can easily implement this on your own by changing the post.tmpl
template (look at the html_tags
macro for an example on how to format it, the category name should be available in post.meta["category"]
).
Thank You @Kwpolska ! I was able to code the desired effect for my blog's default language, but now i struggle to make the link aware of a translated language.
I did this (main language is "de") inside the file post.tmpl: `
category: {{ post.meta('category') }}
<div><a class="reference" href="/categories/cat_{{ post.meta('category') }}/"> <i class="mdi-action-done"></i>{{ post.meta('category') }}</a></div>
{{ helper.html_tags(post) }}
{{ helper.html_pager(post) }}
</nav>`
It works fine for default language blogpostings, but when i see an into English (en) language translated blogposting, the hyperlink should have an "/en" prefix:
<a href="/en/categories/cat_{{ post.meta('category') }}">
But he has not.
How do i correctly link to the translated category?
In my conf.py, i have set the option CATEGORY_TRANSLATIONS_ADD_DEFAULTS = True
You can use the _link
function. This should work (untested):
<a href="{{ _link('category', post.meta('category'), lang) }}">{{ post.meta('category') }}</a>
Thank you @Kwpolska, it worked !
Using the material theme with nikola, i struggle to understand how to display the category of a blogpost automatically (next to the automatic-generated list of tags) in a blogpost.
I understand that i can link from the navbar to the category overview page to display all tags and all categories, but i want that