New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use tags #5
Comments
Thanks! I currently have no use for a tags system on my own website, but it shouldn't be too hard to implement on top of the theme. Basically it would involve overriding the page template (page.html) to add a list of tags to posts, creating "tag list" and "tag page" templates, and adding those pages (as markdown). I'd also be happy to help out if you wanna make a PR for the theme itself. (Too busy to implement this myself at the moment, sorry!) |
@InputUsername After looking at some other themes I tried the following. I created two files under templates directory {% extends "page.html" %}
{% block main %}
<main>
<small>
<div>
<h1> tags </h1>
{% set tags = get_taxonomy(kind="tags") %}
{% for post in tags.items %}
<a href="{{ post.permalink }}">#{{ post.name }}</a>
{% endfor %}
</div>
</small>
</main>
{% endblock %}
taxonomies = [
{ name = "tags" }
] title = "rust-blog"
[taxonomies]
tags = ["rust", "ssg", "other"] When invoking zola serve
Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 7 pages (0 orphan) and 2 sections
Error: Failed to serve the site
Error: Failed to render a list of tags page.
Error: Reason: Failed to render 'taxonomy_list.html' (error happened in a parent template)
Error: Reason: Variable `page.title` not found in context while rendering 'taxonomy_list.html' Can you help me with this? I'm happy to create a PR if this is fixed and add tags support to the theme. |
Hi! Thank you for the great theme! It is very nice to see a minimal theme with a dark mode support. I wonder if it is possible to add tags to posts and list them in a dedicated page? E.g. see how it is done in the "anpu" theme: github, demo.
The text was updated successfully, but these errors were encountered: