From 14f8b9cbcde3bd661b768f7f93b6bec808386c99 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 23:29:33 -0700 Subject: posts template hide date option --- config.toml | 1 + templates/posts.html | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/config.toml b/config.toml index 45f7f60..a1da403 100644 --- a/config.toml +++ b/config.toml @@ -114,6 +114,7 @@ recent_items = 9 meta_index = { position="bottom", size="s90", author=false, readtime=false, readstring="min", date=true, categories_tags=true, divider=" " } meta_post = { position="top", size="s95", author=true, readtime=false, readstring="min read", date=true, categories_tags=true, divider=" " } +hide_section_dates = false # hides the date for sections that use posts.html as their template. title_size_index = "s85" # size: s95, s90, s85, s80, s75, s70, false(full size) footer_size = "s90" # size: s95, s90, s85, s80, s75, s70, false(full size) footer_credit = true diff --git a/templates/posts.html b/templates/posts.html index 55d997f..e4562ab 100644 --- a/templates/posts.html +++ b/templates/posts.html @@ -39,17 +39,28 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- else %} {%- set section_item = get_section(path=sec ~ "_index." ~ lang ~ ".md") %} {%- endif %} + {%- if sec != "" %} + {#- the section always overrides the config -#} + {%- if section_item.extra and 'hide_section_dates' in section_item.extra -%} + {%- set hide_section_dates = section_item.extra.hide_section_dates -%} + {%- elif config.extra.hide_section_dates -%} + {%- set hide_section_dates = true -%} + {%- endif -%} + {%- endif %}
{%- if section_item.title %}

{{ section_item.title }}

{%- endif %} - - {{ section_item.content | safe }} - {%- for year, posts in section_item.pages | group_by(attribute="year") %} - {%- if section_item.title %}

{{ year }}

{%- else %}

{{ year }}

{%- endif %} + {%- if not hide_section_dates %} + {%- if section_item.title %} +

{{ year }}

+ {%- else %} +

{{ year }}

+ {%- endif %} + {%- endif %} {%- for post in posts %} -

{{ post.title }} -

+

{{ post.title }}{%- if not hide_section_dates %} - {%- endif %}

{%- endfor %} {%- endfor %}
-- cgit v1.3.1