aboutsummaryrefslogtreecommitdiff
path: root/templates/index.html
diff options
context:
space:
mode:
authorJieiku2023-05-22 23:24:44 -0700
committerJieiku2023-05-22 23:24:44 -0700
commit3af6d9131f6dfc138856d718ec96626344095ec8 (patch)
tree1a8d75cf494d5333da2cb02506e04c9e0f576f6d /templates/index.html
parent3ca36cc469e838cee7d3fdcdc6ff39b35313a293 (diff)
downloadabridge-3af6d9131f6dfc138856d718ec96626344095ec8.tar.gz
abridge-3af6d9131f6dfc138856d718ec96626344095ec8.tar.bz2
abridge-3af6d9131f6dfc138856d718ec96626344095ec8.zip
Optimizations and Fixes
Diffstat (limited to 'templates/index.html')
-rw-r--r--templates/index.html28
1 files changed, 23 insertions, 5 deletions
diff --git a/templates/index.html b/templates/index.html
index 84314b1..ce224c0 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,3 +1,8 @@
+{#
+This Page Shows the Posts with a short summary on the index: example.com/
+This Template can also be used as the rendering template for Sections, eg: example.com/blog/ example.com/software/
+#}
+
{%- extends "base.html" %}
{%- block seo %}
@@ -54,12 +59,25 @@
{%- endfor %}
{{- macros::pagination(paginator=paginator, config=config) }}
</div>
- {%- if lang == config.default_language %}
- {%- set section_item = get_section(path="_index.md") %}
- {%- else %}
- {%- set section_item = get_section(path="_index." ~ lang ~ ".md") %}
- {%- endif %}
{%- if config.extra.recent | default(value=true) %}
+ {#- The following line is checking if the template is being used for the root or a section #}
+ {%- if current_path is matching("^(/[[:alpha:]][[:alpha:]])?(/page/[[:digit:]]+)?/$") %}
+ {%- set sec = "" %}
+ {%- else %}
+ {%- if lang == config.default_language %}
+ {%- set sec = current_path | trim_start_matches(pat="/") | split(pat="/page/") | slice(end=1) | join(sep="") | trim_end_matches(pat="/") %}
+ {%- set sec = sec ~ "/" %}
+ {%- else %}
+ {%- set sec = current_path | trim_start_matches(pat="/" ~ lang ~ "/") | split(pat="/page/") | slice(end=1) | join(sep="") | trim_end_matches(pat="/") %}
+ {%- set sec = sec ~ "/" %}
+ {%- endif %}
+ {%- endif %}
+
+ {%- if lang == config.default_language %}
+ {%- set section_item = get_section(path=sec ~ "_index.md") %}
+ {%- else %}
+ {%- set section_item = get_section(path=sec ~ "_index." ~ lang ~ ".md") %}
+ {%- endif %}
<div class="toc">
<div class="toc-sticky">
<h1><span class="s70">{%- if lang != config.default_language %}{{ trans(key="Recent_Posts" | safe, lang=lang) }}{% else %}Recent Posts{% endif %}</span></h1>