mirror of
https://github.com/welpo/tabi.git
synced 2025-12-14 11:48:45 +01:00
feat: optional alternative tags sort order based on posts count
This commit is contained in:
parent
82ecbc1454
commit
c685b95f9e
4 changed files with 23 additions and 0 deletions
|
|
@ -188,6 +188,11 @@ separator = "•"
|
|||
# Compact: tag_name^n (superscript number)
|
||||
compact_tags = false
|
||||
|
||||
# How tags are sorted in a Tags listing based on templates/tags/list.html.
|
||||
# "name" for alphabetical, "frequency" for descending count of posts.
|
||||
# Default: "name".
|
||||
tag_sorting = "name"
|
||||
|
||||
# Invert the order of the site title and page title in the browser tab.
|
||||
# Example: true => "Blog • ~/tabi", false => "~/tabi • Blog"
|
||||
invert_title_order = false
|
||||
|
|
|
|||
|
|
@ -225,6 +225,16 @@ Setting `compact_tags = true` will display them as:
|
|||
|
||||
[TagName](#) <sup>n</sup>
|
||||
|
||||
### Tags Sorting
|
||||
|
||||
| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript |
|
||||
|:----:|:-------:|:-------------:|:-----------------:|:-------------------:|
|
||||
| ❌ | ❌ | ✅ | ❌ | ❌ |
|
||||
|
||||
By default, the [tags page](/tags) sorts tags alphabetically, given the default setting of `tag_sorting = "name"`.
|
||||
|
||||
Setting `tag_sorting = "frequency"` will sort them by number-of-posts (descending).
|
||||
|
||||
---
|
||||
|
||||
## Git Repository Integration
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
{{ macros_page_header::page_header(title=title)}}
|
||||
|
||||
{% set tag_count = terms | length %}
|
||||
{% if config.extra.tag_sorting == "frequency" %}
|
||||
{% set terms = terms | sort(attribute="pages") | reverse %}
|
||||
{% endif %}
|
||||
<div id="tag-cloud" class="{% if tag_count > 16 %}three-columns{% elif tag_count > 8 %}two-columns{% endif %}">
|
||||
<ul class="tags">
|
||||
{%- for term in terms -%}
|
||||
|
|
|
|||
|
|
@ -146,6 +146,11 @@ separator = "•"
|
|||
# Compact: tag_name^n (superscript number)
|
||||
compact_tags = false
|
||||
|
||||
# How tags are sorted in a Tags listing based on templates/tags/list.html.
|
||||
# "name" for alphabetical, "frequency" for descending count of posts.
|
||||
# Default: "name".
|
||||
tag_sorting = "name"
|
||||
|
||||
# Invert the order of the site title and page title in the browser tab.
|
||||
# Example: true => "Blog • ~/tabi", false => "~/tabi • Blog"
|
||||
invert_title_order = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue