From 13613a593f4dd81848577b8a9f360848b54beb0f Mon Sep 17 00:00:00 2001
From: Digital Studium
Date: Sun, 23 Jul 2023 11:47:23 +0300
Subject: [PATCH] Refactor
---
templates/base.j2 | 9 +++++++++
templates/components/all_languages.j2 | 2 +-
templates/components/head.j2 | 9 ---------
templates/components/index.j2 | 8 +++++---
templates/components/schema.j2 | 5 ++++-
templates/components/sidebar.j2 | 10 ++++++----
6 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/templates/base.j2 b/templates/base.j2
index 3cdddf6..c85e499 100644
--- a/templates/base.j2
+++ b/templates/base.j2
@@ -1,3 +1,12 @@
+{% set title = config.languages[language].title %}
+{% set description = config.languages[language].description %}
+{% if section %}
+{% set title = translate(section, language) | capitalize %}
+{% set description = title %}
+{% elif not home %}
+{% set title = post.title %}
+{% set description = post.description %}
+{% endif %}
{% include "components/head.j2" %}
diff --git a/templates/components/all_languages.j2 b/templates/components/all_languages.j2
index c5beae3..9467ac7 100644
--- a/templates/components/all_languages.j2
+++ b/templates/components/all_languages.j2
@@ -16,4 +16,4 @@
{% endif %}
{% endfor %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/templates/components/head.j2 b/templates/components/head.j2
index 5a2b43c..9f1eee9 100644
--- a/templates/components/head.j2
+++ b/templates/components/head.j2
@@ -1,15 +1,6 @@
- {% set title = config.languages[language].title %}
- {% set description = config.languages[language].description %}
- {% if section %}
- {% set title = (translate(section, language) | capitalize) + " | " + title %}
- {% set description = title %}
- {% elif not home %}
- {% set title = post.title + " | " + title %}
- {% set description = post.description %}
- {% endif %}
{{ title }}
diff --git a/templates/components/index.j2 b/templates/components/index.j2
index e2fca1c..846ad34 100644
--- a/templates/components/index.j2
+++ b/templates/components/index.j2
@@ -1,5 +1,7 @@
{% for section, urls in posts[language].items() %}
-{% for url, post in urls.items() %}
-{% include "components/post_summary.j2" %}
-{% endfor %}
+ {% if section != "/" %}
+ {% for url, post in urls.items() %}
+ {% include "components/post_summary.j2" %}
+ {% endfor %}
+ {% endif %}
{% endfor %}
\ No newline at end of file
diff --git a/templates/components/schema.j2 b/templates/components/schema.j2
index 20b7782..ddb39c5 100644
--- a/templates/components/schema.j2
+++ b/templates/components/schema.j2
@@ -14,7 +14,10 @@
{
"@context": "https://schema.org",
"@type": {{ config.schema.type }},
- {# "articleSection": {{ translate(section, language) }}, #}
+ {% if section %}
+ "articleSection": {{ translate(section, language) }},
+ {% endif %}
+
{% if config.schema.type == 'TechArticle' %}
"proficiencyLevel": "Beginner",
{% endif %}
diff --git a/templates/components/sidebar.j2 b/templates/components/sidebar.j2
index 456e926..36b38b6 100644
--- a/templates/components/sidebar.j2
+++ b/templates/components/sidebar.j2
@@ -1,9 +1,11 @@
+
\ No newline at end of file