From c19abf855e46ad2f8dd99f59ee6f9a8184d89516 Mon Sep 17 00:00:00 2001 From: Harry Min Khant <118270468+harrymkt@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:46:13 +0630 Subject: [PATCH] Added tags support for themes (#2720) * Added tags support for themes * Docs: updated theme creation documentation, adding the tags optional variable * Changed taxonomy name to `theme-tags` * Revert "Changed taxonomy name to `theme-tags`" This reverts commit 2afd6dba5b4c8f703c5b372a15f137169819f431. * resolving * resolve * Search by tags not shown if no content with `theme-tags` taxonomy is provided --- docs/config.toml | 4 ++++ .../documentation/themes/creating-a-theme.md | 2 ++ docs/templates/theme-tags/list.html | 17 ++++++++++++++ docs/templates/theme-tags/single.html | 22 +++++++++++++++++++ docs/templates/theme.html | 10 +++++++++ docs/templates/themes.html | 4 ++++ 6 files changed, 59 insertions(+) create mode 100644 docs/templates/theme-tags/list.html create mode 100644 docs/templates/theme-tags/single.html diff --git a/docs/config.toml b/docs/config.toml index 262f7dd7e9..656d451fc9 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -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 = "theme-tags"} +] + [search] index_format = "elasticlunr_json" diff --git a/docs/content/documentation/themes/creating-a-theme.md b/docs/content/documentation/themes/creating-a-theme.md index ae862b267e..1931e73447 100644 --- a/docs/content/documentation/themes/creating-a-theme.md +++ b/docs/content/documentation/themes/creating-a-theme.md @@ -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 diff --git a/docs/templates/theme-tags/list.html b/docs/templates/theme-tags/list.html new file mode 100644 index 0000000000..bb2b5ee4e6 --- /dev/null +++ b/docs/templates/theme-tags/list.html @@ -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 %} +
All themes ({{ section.pages | length }}
+Live Demo: {{page.extra.demo}}
{% endif %} + {% if page.taxonomies["theme-tags"] %} +Tags:
+Last updated: {{page.extra.updated }}
diff --git a/docs/templates/themes.html b/docs/templates/themes.html index 85a837112d..8ede7f2e47 100644 --- a/docs/templates/themes.html +++ b/docs/templates/themes.html @@ -9,6 +9,10 @@