From 810f1f419ef578923ce4735ec62c8fcf5dc7c06d Mon Sep 17 00:00:00 2001 From: mbaudis Date: Tue, 10 Sep 2019 13:51:37 +0200 Subject: [PATCH] category update --- categories/news-alpha-sorted-reverse.md | 105 ++++++++++++++++++++++++ categories/news-alpha-sorted.md | 105 ++++++++++++++++++++++++ categories/news-date-sorted-reverse.md | 89 ++++++++++++++++++++ categories/news-date-sorted.md | 89 ++++++++++++++++++++ categories/news.md | 89 ++++++++++++++++++++ 5 files changed, 477 insertions(+) create mode 100644 categories/news-alpha-sorted-reverse.md create mode 100644 categories/news-alpha-sorted.md create mode 100644 categories/news-date-sorted-reverse.md create mode 100644 categories/news-date-sorted.md create mode 100644 categories/news.md diff --git a/categories/news-alpha-sorted-reverse.md b/categories/news-alpha-sorted-reverse.md new file mode 100644 index 0000000..9ef2b3e --- /dev/null +++ b/categories/news-alpha-sorted-reverse.md @@ -0,0 +1,105 @@ +--- +layout: default +--- + +{%- assign this_name = page.name | split: "." -%} +{%- assign this_category = this_name[0] | replace: '-alpha-sorted-reverse', '' -%} +{%- assign this_pagetitle = this_category | capitalize | replace: '_', ' ' -%} + +
+ +
+

{{ this_pagetitle }}

+
+
+ +{%- comment -%} + * collecting the pages +{%- endcomment -%} + +{%- assign cat_posts = site.emptyArray -%} +{%- for post in site.documents -%} + {%- if post.categories contains this_category -%} + {%- assign cat_posts = cat_posts | push: post -%} + {%- endif -%} +{%- endfor -%} + +{%- assign cat_posts = cat_posts | sort: 'title' | reverse -%} + +{%- comment -%} + * special posts for prepending content to the listing pages + * they are processed first, so separate loops are needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.prepend' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * featured posts on top, so new loop +{%- endcomment -%} + +{%- for post in cat_posts -%} + + {%- if post.tags contains '.featured' -%} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} +
+ +{{ post.excerpt }} + +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {% if post.date %}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * remaining normal posts, again new loop +{%- endcomment -%} + +{%- for post in cat_posts -%} + {% unless post.tags contains '.featured' or post.tags contains '.prepend' or post.tags contains '.append' %} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} +
+ +{{ post.excerpt }} + +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {% if post.date %}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {% endunless %} +{%- endfor -%} + +{%- comment -%} + * special posts for appending content to the listing pages + * they are processed last, so again a separate loop is needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.append' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + diff --git a/categories/news-alpha-sorted.md b/categories/news-alpha-sorted.md new file mode 100644 index 0000000..a3040ec --- /dev/null +++ b/categories/news-alpha-sorted.md @@ -0,0 +1,105 @@ +--- +layout: default +--- + +{%- assign this_name = page.name | split: "." -%} +{%- assign this_category = this_name[0] | replace: '-alpha-sorted', '' -%} +{%- assign this_pagetitle = this_category | capitalize | replace: '_', ' ' -%} + +
+ +
+

{{ this_pagetitle }}

+
+
+ +{%- comment -%} + * collecting the pages +{%- endcomment -%} + +{%- assign cat_posts = site.emptyArray -%} +{%- for post in site.documents -%} + {%- if post.categories contains this_category -%} + {%- assign cat_posts = cat_posts | push: post -%} + {%- endif -%} +{%- endfor -%} + +{%- assign cat_posts = cat_posts | sort: 'title' -%} + +{%- comment -%} + * special posts for prepending content to the listing pages + * they are processed first, so separate loops are needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.prepend' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * featured posts on top, so new loop +{%- endcomment -%} + +{%- for post in cat_posts -%} + + {%- if post.tags contains '.featured' -%} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} +
+ +{{ post.excerpt }} + +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {% if post.date %}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * remaining normal posts, again new loop +{%- endcomment -%} + +{%- for post in cat_posts -%} + {% unless post.tags contains '.featured' or post.tags contains '.prepend' or post.tags contains '.append' %} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} +
+ +{{ post.excerpt }} + +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {% if post.date %}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {% endunless %} +{%- endfor -%} + +{%- comment -%} + * special posts for appending content to the listing pages + * they are processed last, so again a separate loop is needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.append' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + diff --git a/categories/news-date-sorted-reverse.md b/categories/news-date-sorted-reverse.md new file mode 100644 index 0000000..5b71f5c --- /dev/null +++ b/categories/news-date-sorted-reverse.md @@ -0,0 +1,89 @@ +--- +layout: default +--- + +{%- assign this_name = page.name | split: "." -%} +{%- assign this_category = this_name[0] | replace: '-date-sorted-reverse', '' -%} +{%- assign this_pagetitle = this_category | capitalize | replace: '_', ' ' -%} + +
+ +
+

{{ this_pagetitle }}

+
+
+ +{%- comment -%} + * collecting the pages +{%- endcomment -%} + +{%- assign cat_posts = site.emptyArray -%} +{%- for post in site.documents -%} + {%- if post.categories contains this_category -%} + {%- assign cat_posts = cat_posts | push: post -%} + {%- endif -%} +{%- endfor -%} + +{%- assign cat_posts = cat_posts | sort: 'date' -%} + +{%- comment -%} + * special posts for prepending content to the listing pages + * they are processed first, so separate loops are needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.prepend' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * no separate treatment of featured posts +{%- endcomment -%} + +{%- assign today = site.time | date: '%Y%m%d' -%} +{%- assign page_tag = this_category | downcase -%} + +{%- for post in cat_posts -%} + {% unless post.tags contains '.prepend' or post.tags contains '.append' %} + {%- assign post_author = post.author | downcase -%} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} + {%- assign post_day = post.date | date: '%Y%m%d' -%} + {%- assign post_year = post.date | date: '%Y' -%} + {%- if post_day > today -%} + {%- assign post_year = 'Upcoming' -%} + {%- endif %} + {%- if current_year != post_year -%} + {% assign current_year = post_year %} +

{{ current_year }}

+ {% endif %} +
+ {%- if post_day > today -%} +

{{ post.date | date: "%Y-%m-%d" }}

+ {%- endif -%} +{{ post.excerpt }} +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {%- if post.date -%}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {% endunless %} +{%- endfor -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.append' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} diff --git a/categories/news-date-sorted.md b/categories/news-date-sorted.md new file mode 100644 index 0000000..47abe44 --- /dev/null +++ b/categories/news-date-sorted.md @@ -0,0 +1,89 @@ +--- +layout: default +--- + +{%- assign this_name = page.name | split: "." -%} +{%- assign this_category = this_name[0] | replace: '-date-sorted', '' -%} +{%- assign this_pagetitle = this_category | capitalize | replace: '_', ' ' -%} + +
+ +
+

{{ this_pagetitle }}

+
+
+ +{%- comment -%} + * collecting the pages +{%- endcomment -%} + +{%- assign cat_posts = site.emptyArray -%} +{%- for post in site.documents -%} + {%- if post.categories contains this_category -%} + {%- assign cat_posts = cat_posts | push: post -%} + {%- endif -%} +{%- endfor -%} + +{%- assign cat_posts = cat_posts | sort: 'date' | reverse -%} + +{%- comment -%} + * special posts for prepending content to the listing pages + * they are processed first, so separate loops are needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.prepend' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * no separate treatment of featured posts +{%- endcomment -%} + +{%- assign today = site.time | date: '%Y%m%d' -%} +{%- assign page_tag = this_category | downcase -%} + +{%- for post in cat_posts -%} + {% unless post.tags contains '.prepend' or post.tags contains '.append' %} + {%- assign post_author = post.author | downcase -%} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} + {%- assign post_day = post.date | date: '%Y%m%d' -%} + {%- assign post_year = post.date | date: '%Y' -%} + {%- if post_day > today -%} + {%- assign post_year = 'Upcoming' -%} + {%- endif %} + {%- if current_year != post_year -%} + {% assign current_year = post_year %} +

{{ current_year }}

+ {% endif %} +
+ {%- if post_day > today -%} +

{{ post.date | date: "%Y-%m-%d" }}

+ {%- endif -%} +{{ post.excerpt }} +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {%- if post.date -%}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {% endunless %} +{%- endfor -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.append' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} diff --git a/categories/news.md b/categories/news.md new file mode 100644 index 0000000..47abe44 --- /dev/null +++ b/categories/news.md @@ -0,0 +1,89 @@ +--- +layout: default +--- + +{%- assign this_name = page.name | split: "." -%} +{%- assign this_category = this_name[0] | replace: '-date-sorted', '' -%} +{%- assign this_pagetitle = this_category | capitalize | replace: '_', ' ' -%} + +
+ +
+

{{ this_pagetitle }}

+
+
+ +{%- comment -%} + * collecting the pages +{%- endcomment -%} + +{%- assign cat_posts = site.emptyArray -%} +{%- for post in site.documents -%} + {%- if post.categories contains this_category -%} + {%- assign cat_posts = cat_posts | push: post -%} + {%- endif -%} +{%- endfor -%} + +{%- assign cat_posts = cat_posts | sort: 'date' | reverse -%} + +{%- comment -%} + * special posts for prepending content to the listing pages + * they are processed first, so separate loops are needed +{%- endcomment -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.prepend' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%} + +{%- comment -%} + * no separate treatment of featured posts +{%- endcomment -%} + +{%- assign today = site.time | date: '%Y%m%d' -%} +{%- assign page_tag = this_category | downcase -%} + +{%- for post in cat_posts -%} + {% unless post.tags contains '.prepend' or post.tags contains '.append' %} + {%- assign post_author = post.author | downcase -%} + {%- assign excerpt_link = post.url | relative_url -%} + {%- if post.excerpt_link contains '/' -%} + {%- assign excerpt_link = post.excerpt_link -%} + {%- endif -%} + {%- assign post_day = post.date | date: '%Y%m%d' -%} + {%- assign post_year = post.date | date: '%Y' -%} + {%- if post_day > today -%} + {%- assign post_year = 'Upcoming' -%} + {%- endif %} + {%- if current_year != post_year -%} + {% assign current_year = post_year %} +

{{ current_year }}

+ {% endif %} +
+ {%- if post_day > today -%} +

{{ post.date | date: "%Y-%m-%d" }}

+ {%- endif -%} +{{ post.excerpt }} +

+ {%- if post.author -%}{{ post.author | join: " | " }} {%- endif -%} + {%- if post.date -%}{{ post.date | date: "%Y-%m-%d" }}: {% endif %} + more ... +

+
+ {% endunless %} +{%- endfor -%} + +{%- for post in cat_posts -%} + {%- if post.tags contains '.append' -%} +
+{{ post.content | markdownify }} +
+ {%- endif -%} +{%- endfor -%}