diff options
| author | Jieiku | 2023-05-22 23:29:33 -0700 |
|---|---|---|
| committer | Jieiku | 2023-05-22 23:29:33 -0700 |
| commit | 14f8b9cbcde3bd661b768f7f93b6bec808386c99 (patch) | |
| tree | e8518a2ef211a4a23db484d446689ea0f04a0859 | |
| parent | 76c92f0d7f35a808c69fd21c5a1ed9b664cd6b5b (diff) | |
| download | abridge-14f8b9cbcde3bd661b768f7f93b6bec808386c99.tar.gz abridge-14f8b9cbcde3bd661b768f7f93b6bec808386c99.tar.bz2 abridge-14f8b9cbcde3bd661b768f7f93b6bec808386c99.zip | |
posts template hide date option
| -rw-r--r-- | config.toml | 1 | ||||
| -rw-r--r-- | 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 %} <div> {%- if section_item.title %} <h2>{{ section_item.title }}</h2> {%- endif %} - - {{ section_item.content | safe }} - {%- for year, posts in section_item.pages | group_by(attribute="year") %} - {%- if section_item.title %}<h3>{{ year }}</h3>{%- else %}<h2>{{ year }}</h2>{%- endif %} + {%- if not hide_section_dates %} + {%- if section_item.title %} + <h3>{{ year }}</h3> + {%- else %} + <h2>{{ year }}</h2> + {%- endif %} + {%- endif %} {%- for post in posts %} - <p><a href="{{ post.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ post.title }}</a> - <time datetime="{{ post.date }}">{{ post.date | date(format="%F") }}</time></p> + <p><a href="{{ post.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ post.title }}</a>{%- if not hide_section_dates %} - <time datetime="{{ post.date }}">{{ post.date | date(format="%F") }}</time>{%- endif %}</p> {%- endfor %} {%- endfor %} </div> |
