aboutsummaryrefslogtreecommitdiff
path: root/templates/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/index.html')
-rw-r--r--templates/index.html29
1 files changed, 26 insertions, 3 deletions
diff --git a/templates/index.html b/templates/index.html
index 7c8c45a..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,30 @@
{%- endfor %}
{{- macros::pagination(paginator=paginator, config=config) }}
</div>
- {%- set section_item = get_section(path="_index.md") %}
{%- 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="s75">Recent Posts</span></h1>
- {%- for page in section_item.pages | slice(end=config.extra.recent_items) %}
+ <h1><span class="s70">{%- if lang != config.default_language %}{{ trans(key="Recent_Posts" | safe, lang=lang) }}{% else %}Recent Posts{% endif %}</span></h1>
+ {%- set recent_items=config.extra.recent_items | default(value=9) -%}
+ {%- for page in section_item.pages | slice(end=recent_items) %}
{{- page_macros::page_listing(page=page, config=config) }}
{%- endfor %}
</div>