From 6a2bd100a2349632febe519b954a92468c3c1697 Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Wed, 24 Oct 2018 17:51:53 +0800 Subject: [PATCH] Add the 'generators' for categories and tags --- _config.yml | 16 ++++++- _generators/categories.md | 4 ++ _generators/tags.md | 4 ++ _includes/libraries.html | 12 ++++++ _includes/post_meta.html | 41 +++++++++--------- _layouts/generator.html | 57 +++++++++++++++++++++++++ _layouts/home.html | 27 +----------- _layouts/post.html | 4 +- _layouts/tags.html | 24 ----------- _sass/_custom.scss | 21 ++++----- _sass/custom_elems/_pinned_posts.scss | 4 +- _sass/custom_layout/_footer.scss | 4 +- _sass/custom_layout/_header.scss | 4 +- _sass/minima.scss | 10 ++--- _sass/minima/_base.scss | 7 +-- _sass/minima/_layout.scss | 22 ++++------ _sass/pages/classification_pages.scss | 30 +++++++++++++ _sass/pages/index.scss | 1 + _sass/pages/notes.scss | 2 +- _sass/post_content/_list_container.scss | 2 +- _sass/post_content/_post.scss | 12 ++++++ _sass/post_content/_post_links.scss | 2 +- _sass/post_content/_tags.scss | 2 +- 23 files changed, 192 insertions(+), 120 deletions(-) create mode 100644 _generators/categories.md create mode 100644 _generators/tags.md create mode 100644 _layouts/generator.html delete mode 100644 _layouts/tags.html create mode 100644 _sass/pages/classification_pages.scss diff --git a/_config.yml b/_config.yml index cc65f6b..8e28f4f 100644 --- a/_config.yml +++ b/_config.yml @@ -29,7 +29,7 @@ gitlab_username: foo-dogsquared linkedin_username: gabriel-arazas twitter_username: foo_dogsquared paginate: 10 -paginate_path: '/page:num/' +paginate_path: 'page/:num/' # Enabling Disqus disqus: @@ -48,15 +48,27 @@ pinpost: ["A Freebie's Resource List (Mostly Related to Programming)"] google_analytics: UA-126718538-1 +collections: + generators: + output: true + permalink: data/:name + # Default settings defaults: - scope: - path: "" + path: "_posts" type: "posts" values: permalink: posts/:title + layout: post comments: true + - + scope: + path: "_generators" + type: "generators" + values: + layout: generator # Exclude from processing. # The following items will not be processed, by default. Create a custom list diff --git a/_generators/categories.md b/_generators/categories.md new file mode 100644 index 0000000..181cb55 --- /dev/null +++ b/_generators/categories.md @@ -0,0 +1,4 @@ +--- +data: categories +title: Categories +--- diff --git a/_generators/tags.md b/_generators/tags.md new file mode 100644 index 0000000..5bd6630 --- /dev/null +++ b/_generators/tags.md @@ -0,0 +1,4 @@ +--- +data: tags +title: Tags +--- diff --git a/_includes/libraries.html b/_includes/libraries.html index 8a4aced..8fa33af 100644 --- a/_includes/libraries.html +++ b/_includes/libraries.html @@ -1,2 +1,14 @@ + \ No newline at end of file diff --git a/_includes/post_meta.html b/_includes/post_meta.html index e75f21b..1de3283 100644 --- a/_includes/post_meta.html +++ b/_includes/post_meta.html @@ -1,22 +1,25 @@

- - - - {{ page.content | number_of_words }} minutes - + {%- assign page = include.page -%} + {%- assign include_link = include.include_link -%} + - {%- if page.categories -%} - - {%- endif -%} - - {%- if page.updatedOn -%} -

Updated: {{ page.updatedOn | escape }}

- {%- endif -%} + + {{ page.content | number_of_words }} minutes + + + {%- if page.categories -%} + + + {%- if include_link -%}{{ page.categories }} + {%- else -%}{{ page.categories }}{%- endif -%} + + {%- endif -%} + + {%- if page.updatedOn -%} +

Updated: {{ page.updatedOn | escape }}

+ {%- endif -%}

\ No newline at end of file diff --git a/_layouts/generator.html b/_layouts/generator.html new file mode 100644 index 0000000..00c38d0 --- /dev/null +++ b/_layouts/generator.html @@ -0,0 +1,57 @@ +--- +layout: default +--- + +{%- if content -%} + {{ content }} +{%- endif -%} + + +{%- if page.data -%} + {% assign page_data = page.data %} + {% assign rawdata = "" %} + {% for post in site.posts %} + {% assign tdata = post[page_data] | join:'|' | append:'|' %} + {% assign rawdata = rawdata | append:tdata %} + {% endfor %} + {% assign rawdata = rawdata | split:'|' | sort %} + + {% assign data = "" %} + {% for datum in rawdata %} + {% if datum != "" %} + {% if data == "" %} + {% assign data = datum | split:'|' %} + {% endif %} + {% unless data contains datum %} + {% assign data = data | join:'|' | append:'|' | append:datum | split:'|' %} + {% endunless %} + {% endif %} + {% endfor %} + +
+ {% for datum in data %} {{ datum }} {% endfor %} +
+ +{% for datum in data %} +
+

{{ datum }}

+ +
+{% endfor %} +{%- endif -%} diff --git a/_layouts/home.html b/_layouts/home.html index 98d5c9c..ebba6c2 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -23,32 +23,7 @@ layout: default {% for post in paginator.posts %}

{{ post.title }}

- + {%- include post_meta.html page=post include_link=true -%}
{% endfor %}