From e390130d264458ad8932f66ce25275be52dd811a Mon Sep 17 00:00:00 2001 From: Che <43485962+c-git@users.noreply.github.com> Date: Thu, 2 Jun 2022 17:59:34 -0400 Subject: [PATCH 1/6] Remove unnecessary white space Adding a "-" before the "%}" removes white space after the statement. Source: https://tera.netlify.app/docs#whitespace-control --- templates/index.html | 113 +++++++++++++++++++++-------------------- templates/section.html | 11 ++-- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/templates/index.html b/templates/index.html index 32c157f..d4c407d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,19 +3,19 @@ - {% if config.extra.favicon %} - {% set _favicon = config.extra.favicon %} - {% if (_favicon is starting_with("http")) == false %} - {% set _favicon = get_url(path=config.extra.favicon) %} - {% endif %} + {% if config.extra.favicon -%} + {% set _favicon = config.extra.favicon -%} + {% if (_favicon is starting_with("http")) == false -%} + {% set _favicon = get_url(path=config.extra.favicon) -%} + {% endif -%} - {% endif %} + {% endif -%} {% block title %}{{ config.title }}{% endblock title %} -{% if config.extra.release %} +{% if config.extra.release -%} -{% endif %} +{% endif -%}
- {% block nav %} + {% block nav -%} - {% endblock nav %} + {% endblock nav -%}
- {% if config.build_search_index %} + {% if config.build_search_index -%}
@@ -126,10 +127,10 @@ - {% endif %} + {% endif -%}
- {% block content %} + {% block content -%} {{ section.content | safe }} {% endblock content %}
@@ -141,7 +142,7 @@ -{% endif %} +{% endif -%} diff --git a/templates/section.html b/templates/section.html index abbf1a2..3e8a21e 100644 --- a/templates/section.html +++ b/templates/section.html @@ -2,21 +2,20 @@ {% block title %} {{ config.title }} | {{ section.title }} {% endblock title %} - {% block content %} - {% if section.word_count > 0 %} + {% if section.word_count > 0 -%} {{ section.content }} - {% else %} + {% else -%}

{{ section.title }}

Pages: - {% endif %} + {% endif -%} {% endblock content %} From c88c34eff6b4c0fea938edf8ed3be0fb5fd53cd1 Mon Sep 17 00:00:00 2001 From: Che <43485962+c-git@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:10:23 -0400 Subject: [PATCH 2/6] Handle the case where a section has no pages --- templates/section.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/section.html b/templates/section.html index 3e8a21e..416ab0e 100644 --- a/templates/section.html +++ b/templates/section.html @@ -6,14 +6,16 @@ {% if section.word_count > 0 -%} {{ section.content }} {% else -%} -

- {{ section.title }} -

- Pages: +

{{ section.title }}

+

Pages:

{% endif -%} {% endblock content %} From 6253b4317458a45401bdd29dd77df27d78fe40c3 Mon Sep 17 00:00:00 2001 From: Che <43485962+c-git@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:25:00 -0400 Subject: [PATCH 3/6] Add minimal support for subsections --- templates/section.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/section.html b/templates/section.html index 416ab0e..d9c0b12 100644 --- a/templates/section.html +++ b/templates/section.html @@ -7,6 +7,17 @@ {{ section.content }} {% else -%}

{{ section.title }}

+ + {% if section.subsections -%} +

Subsections:

+ + {% endif -%} +

Pages: