Skip to content
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

Added tags support for themes #2720

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ description = "Everything you need to make a static site engine in one binary."
compile_sass = true
build_search_index = true

taxonomies = [
{ name = "tags"}
]

[search]
index_format = "elasticlunr_json"

Expand Down
2 changes: 2 additions & 0 deletions docs/content/documentation/themes/creating-a-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ following fields:
```toml
name = "my theme name"
description = "A classic blog theme"
# An optional tags to allow quick search
tags = []
license = "MIT"
homepage = "https://github.com/getzola/hyde"
# The minimum version of Zola required
Expand Down
17 changes: 17 additions & 0 deletions docs/templates/tags/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "index.html" %}

{% block extra_nav_class %}{% endblock extra_nav_class %}
{% block extra_content_class %}content--reversed{% endblock extra_content_class %}

{% block title %}Themes | {{ super() }} {% endblock title %}

{% block content %}
<h1>Tags</h1>
{% set section = get_section(path = "themes/_index.md") %}
<p><a href="{{ get_url(path = "themes") }}">All themes ({{ section.pages | length }}</a></p>
<ul>
{% for t in terms %}
<li><a href="{{ t.permalink }}">{{ t.name }}({{ t.page_count }}</a></li>
{% endfor %}
</ul>
{% endblock content %}
22 changes: 22 additions & 0 deletions docs/templates/tags/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "index.html" %}

{% block extra_nav_class %}{% endblock extra_nav_class %}
{% block extra_content_class %}content--reversed{% endblock extra_content_class %}

{% block title %}Themes | {{ super() }} {% endblock title %}

{% block content %}
<div class="themes-container">
{% block theme_content %}
<h1>Zola themes in {{ term.name }}</h1>
<div class="themes">
{% for theme in term.pages %}
<a class="theme" href="{{theme.permalink}}">
<img src="{{theme.permalink}}screenshot.png" alt="Screenshot of {{theme.title}}">
<span>{{theme.title}}</span>
</a>
{% endfor %}
</div>
{% endblock theme_content %}
</div>
{% endblock content %}
1 change: 1 addition & 0 deletions docs/templates/themes.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<div class="themes-container">
{% block theme_content %}
<h1>Zola themes</h1>
<p><a href="{{ get_url(path = "tags") }}">Search by tags</a></p>
<div class="themes">
{% for theme in section.pages %}
<a class="theme" href="{{theme.permalink}}">
Expand Down