From 755e0813ef518f276527b1c7512a50ac8bfef1b9 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Sat, 23 Apr 2022 14:47:46 +0200 Subject: [PATCH] refactor --- 404.md | 2 +- _config.yml | 4 +-- .../{ => collection}/collection_base.html | 0 _layouts/collection/collection_index.html | 22 ++++++++++++++++ _layouts/{ => collection}/news.html | 2 +- _layouts/{ => collection}/post.html | 2 +- blog.html | 26 +++---------------- news.html | 24 ++++------------- 8 files changed, 36 insertions(+), 46 deletions(-) rename _layouts/{ => collection}/collection_base.html (100%) create mode 100644 _layouts/collection/collection_index.html rename _layouts/{ => collection}/news.html (53%) rename _layouts/{ => collection}/post.html (53%) diff --git a/404.md b/404.md index b97ea868..ccc5e898 100644 --- a/404.md +++ b/404.md @@ -1,5 +1,5 @@ --- -layout: post +layout: content permalink: /404 backLink: False --- diff --git a/_config.yml b/_config.yml index 9ec488dd..26617c5e 100644 --- a/_config.yml +++ b/_config.yml @@ -44,12 +44,12 @@ defaults: path: "" type: "posts" values: - layout: "post" + layout: "collection/post" - scope: path: "" type: "news" values: - layout: "news" + layout: "collection/news" - scope: path: "" values: diff --git a/_layouts/collection_base.html b/_layouts/collection/collection_base.html similarity index 100% rename from _layouts/collection_base.html rename to _layouts/collection/collection_base.html diff --git a/_layouts/collection/collection_index.html b/_layouts/collection/collection_index.html new file mode 100644 index 00000000..3b317a9f --- /dev/null +++ b/_layouts/collection/collection_index.html @@ -0,0 +1,22 @@ +--- +layout: default +--- +
+
+

{{ page.title_text }}

+
+ + {% assign cols = site[page.collection] %} + {% if page.collection_reverse == true %}{% assign cols = cols | reverse %}{% endif %} + {% for item in cols %} +
+

+ {{ item.title }} +

+ {{ item.excerpt | strip_html | strip_newlines | truncate: 156 }} + {{ item.date | date_to_string }} | +
+ {% endfor %} +
+
+
diff --git a/_layouts/news.html b/_layouts/collection/news.html similarity index 53% rename from _layouts/news.html rename to _layouts/collection/news.html index 31d8afae..2f89785d 100644 --- a/_layouts/news.html +++ b/_layouts/collection/news.html @@ -1,5 +1,5 @@ --- -layout: collection_base +layout: collection/collection_base base_link: '/news' --- {{ content }} diff --git a/_layouts/post.html b/_layouts/collection/post.html similarity index 53% rename from _layouts/post.html rename to _layouts/collection/post.html index 6da5956c..83746349 100644 --- a/_layouts/post.html +++ b/_layouts/collection/post.html @@ -1,5 +1,5 @@ --- -layout: collection_base +layout: collection/collection_base base_link: '/blog' --- {{ content }} diff --git a/blog.html b/blog.html index a54f32c7..fc2da2a0 100644 --- a/blog.html +++ b/blog.html @@ -1,25 +1,7 @@ --- -layout: default +layout: collection/collection_index title: Blog +title_text: InvenTree Blog permalink: /blog ---- -
-
-

InvenTree Blog

-
- - {% for post in site.posts %} -
-

- {{ post.title }} -

- {{ post.excerpt | strip_html | strip_newlines | truncate: 156 }} - - {{ post.date | date_to_string }} | - {% include partial/publisher_ref.html pub=post.publisher %} - -
- {% endfor %} -
-
-
+collection: posts +--- \ No newline at end of file diff --git a/news.html b/news.html index 3e5ca7f4..4275d4ed 100644 --- a/news.html +++ b/news.html @@ -1,22 +1,8 @@ --- -layout: default +layout: collection/collection_index title: News +title_text: InvenTree News permalink: /news ---- -
-
-

InvenTree News

-
- - {% for post in site.news %} -
-

- {{ post.title }} -

- {{ post.excerpt | strip_html | strip_newlines | truncate: 156 }} - {{ post.date | date_to_string }} | -
- {% endfor %} -
-
-
+collection: news +collection_reverse: true +--- \ No newline at end of file