From 575197bcbd93bc29027f607d3762dc1e37a01dd1 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 15:36:56 -0400 Subject: [PATCH 01/10] Rename include --- _includes/archive-single.html | 2 +- _includes/page__hero.html | 2 +- _includes/{post__meta.html => page__meta.html} | 0 _layouts/single.html | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename _includes/{post__meta.html => page__meta.html} (100%) diff --git a/_includes/archive-single.html b/_includes/archive-single.html index df4f8dfcf0b3..68174807ef50 100644 --- a/_includes/archive-single.html +++ b/_includes/archive-single.html @@ -24,7 +24,7 @@

{{ title }} {% endif %}

- {% include post__meta.html type=include.type %} + {% include page__meta.html type=include.type %} {% if post.excerpt %}

{{ post.excerpt | markdownify | strip_html | truncate: 160 }}

{% endif %} diff --git a/_includes/page__hero.html b/_includes/page__hero.html index 8e477535c9ef..3f55aaa60ac5 100644 --- a/_includes/page__hero.html +++ b/_includes/page__hero.html @@ -31,7 +31,7 @@

{% elsif page.header.show_overlay_excerpt != false and page.excerpt %}

{{ page.excerpt | markdownify | remove: "

" | remove: "

" }}

{% endif %} - {% include post__meta.html %} + {% include page__meta.html %} {% if page.header.cta_url %}

{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}

{% endif %} diff --git a/_includes/post__meta.html b/_includes/page__meta.html similarity index 100% rename from _includes/post__meta.html rename to _includes/page__meta.html diff --git a/_layouts/single.html b/_layouts/single.html index 7116d72d688b..71cb4e83dc66 100644 --- a/_layouts/single.html +++ b/_layouts/single.html @@ -27,7 +27,7 @@ {% unless page.header.overlay_color or page.header.overlay_image %}
{% if page.title %}

{{ page.title | markdownify | remove: "

" | remove: "

" }}

{% endif %} - {% include post__meta.html %} + {% include page__meta.html %}
{% endunless %} From cf007f345dd59e6c17c420e6d71f2d6705fe6f3f Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 15:50:34 -0400 Subject: [PATCH 02/10] Add grid view test pages --- test/_pages/category-archive-grid.md | 7 +++++++ test/_pages/collection-archive-grid.html | 24 ++++++++++++++++++++++++ test/_pages/collection-archive.html | 2 +- test/_pages/edge-case-grid.md | 9 +++++++++ test/_pages/markup-grid.md | 9 +++++++++ test/_pages/page-archive-grid.html | 11 +++++++++++ test/_pages/tag-archive-grid.md | 7 +++++++ test/_pages/year-archive-grid.md | 7 +++++++ 8 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test/_pages/category-archive-grid.md create mode 100644 test/_pages/collection-archive-grid.html create mode 100644 test/_pages/edge-case-grid.md create mode 100644 test/_pages/markup-grid.md create mode 100644 test/_pages/page-archive-grid.html create mode 100644 test/_pages/tag-archive-grid.md create mode 100644 test/_pages/year-archive-grid.md diff --git a/test/_pages/category-archive-grid.md b/test/_pages/category-archive-grid.md new file mode 100644 index 000000000000..3558be0a0db9 --- /dev/null +++ b/test/_pages/category-archive-grid.md @@ -0,0 +1,7 @@ +--- +title: "Posts by Category (grid view)" +layout: categories +permalink: /categories-grid/ +entries_layout: grid +author_profile: true +--- diff --git a/test/_pages/collection-archive-grid.html b/test/_pages/collection-archive-grid.html new file mode 100644 index 000000000000..310eceeab561 --- /dev/null +++ b/test/_pages/collection-archive-grid.html @@ -0,0 +1,24 @@ +--- +layout: archive +title: "Posts by Collection (grid view)" +permalink: /collection-archive-grid/ +entries_layout: grid +author_profile: true +--- + +{% capture written_label %}'None'{% endcapture %} + +{% for collection in site.collections %} + {% unless collection.output == false or collection.label == "posts" %} + {% capture label %}{{ collection.label }}{% endcapture %} + {% if label != written_label %} +

{{ label }}

+ {% capture written_label %}{{ label }}{% endcapture %} + {% endif %} + {% endunless %} + {% for post in collection.docs %} + {% unless collection.output == false or collection.label == "posts" %} + {% include archive-single.html type=page.entries_layout %} + {% endunless %} + {% endfor %} +{% endfor %} \ No newline at end of file diff --git a/test/_pages/collection-archive.html b/test/_pages/collection-archive.html index 80d281642917..8eb06e0665e4 100644 --- a/test/_pages/collection-archive.html +++ b/test/_pages/collection-archive.html @@ -17,7 +17,7 @@

{{ label }}

{% endunless %} {% for post in collection.docs %} {% unless collection.output == false or collection.label == "posts" %} - {% include archive-single.html %} + {% include archive-single.html type=page.entries_layout %} {% endunless %} {% endfor %} {% endfor %} \ No newline at end of file diff --git a/test/_pages/edge-case-grid.md b/test/_pages/edge-case-grid.md new file mode 100644 index 000000000000..c2f73e5a2a93 --- /dev/null +++ b/test/_pages/edge-case-grid.md @@ -0,0 +1,9 @@ +--- +title: Edge Case (grid view) +layout: category +permalink: /categories/edge-case-grid/ +taxonomy: Edge Case +entries_layout: grid +--- + +Sample post listing for the category `Edge Case`. diff --git a/test/_pages/markup-grid.md b/test/_pages/markup-grid.md new file mode 100644 index 000000000000..7ebf0badbdd7 --- /dev/null +++ b/test/_pages/markup-grid.md @@ -0,0 +1,9 @@ +--- +title: Markup (grid view) +layout: tag +permalink: /tags/markup-grid/ +taxonomy: markup +entries_layout: grid +--- + +Sample post listing for the tag `markup`. diff --git a/test/_pages/page-archive-grid.html b/test/_pages/page-archive-grid.html new file mode 100644 index 000000000000..5b900f470259 --- /dev/null +++ b/test/_pages/page-archive-grid.html @@ -0,0 +1,11 @@ +--- +layout: archive +title: "Page Archive" +permalink: /page-archive-grid/ +entries_layout: grid +author_profile: false +--- + +{% for post in site.pages %} + {% include archive-single.html type=page.entries_layout %} +{% endfor %} \ No newline at end of file diff --git a/test/_pages/tag-archive-grid.md b/test/_pages/tag-archive-grid.md new file mode 100644 index 000000000000..fa4df8137729 --- /dev/null +++ b/test/_pages/tag-archive-grid.md @@ -0,0 +1,7 @@ +--- +title: "Posts by Tag (grid view)" +permalink: /tags-grid/ +layout: tags +entries_layout: grid +author_profile: true +--- diff --git a/test/_pages/year-archive-grid.md b/test/_pages/year-archive-grid.md new file mode 100644 index 000000000000..5029212cd32d --- /dev/null +++ b/test/_pages/year-archive-grid.md @@ -0,0 +1,7 @@ +--- +title: "Posts by Year (grid view)" +permalink: /year-archive-grid/ +layout: posts +entries_layout: grid +author_profile: true +--- From 7ec6d2722a288e46db06e571a151e42a644b38d3 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 16:00:47 -0400 Subject: [PATCH 03/10] Rename `.post__meta-sep` and use CSS to add line break --- _includes/page__meta.html | 8 +------- _sass/minimal-mistakes/_archive.scss | 8 ++++++++ _sass/minimal-mistakes/_page.scss | 2 +- docs/_docs/05-configuration.md | 6 +++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/_includes/page__meta.html b/_includes/page__meta.html index 1ea81e5bbcba..3dc85d63fbb6 100644 --- a/_includes/page__meta.html +++ b/_includes/page__meta.html @@ -9,13 +9,7 @@ {% endif %} - {% if page.read_time and page.show_date %} - {% if include.type == "grid" %} -
- {% else %} - - {% endif %} - {% endif %} + {% if page.read_time and page.show_date %}{% endif %} {% if page.read_time %} {% assign words_per_minute = page.words_per_minute | default: site.words_per_minute | default: 200 %} diff --git a/_sass/minimal-mistakes/_archive.scss b/_sass/minimal-mistakes/_archive.scss index 3df299614b00..9f576323e7da 100644 --- a/_sass/minimal-mistakes/_archive.scss +++ b/_sass/minimal-mistakes/_archive.scss @@ -201,6 +201,14 @@ font-size: 0.6em; } + .page__meta-sep { + display: block; + + &::before { + display: none; + } + } + .archive__item-title { margin-top: 0.5em; font-size: $type-size-5; diff --git a/_sass/minimal-mistakes/_page.scss b/_sass/minimal-mistakes/_page.scss index c4bf8ae76b73..f25f75f61107 100644 --- a/_sass/minimal-mistakes/_page.scss +++ b/_sass/minimal-mistakes/_page.scss @@ -299,7 +299,7 @@ body { text-transform: uppercase; } -.post__meta-sep::before { +.page__meta-sep::before { content: "\2022"; padding-left: 0.5em; padding-right: 0.5em; diff --git a/docs/_docs/05-configuration.md b/docs/_docs/05-configuration.md index 3cb1de043fdf..11c22a649ba4 100644 --- a/docs/_docs/05-configuration.md +++ b/docs/_docs/05-configuration.md @@ -311,14 +311,14 @@ To disable reading time for a post, add `read_time: false` to its YAML Front Mat words_per_minute: 250 ``` -### Post meta separator +### Page meta separator -To customise the separator between the post date and reading time (if both are enabled), edit `.post__meta-sep::before` in a [custom stylesheet]({{ "/docs/stylesheets/" | relative_url }}). +To customise the separator between the page date and reading time (if both are enabled), edit `.page__meta-sep::before` in a [custom stylesheet]({{ "/docs/stylesheets/" | relative_url }}). For example, ```css -.post__meta-sep::before { +.page__meta-sep::before { content: "\2022"; padding-left: 0.5em; padding-right: 0.5em; From bcafd029c32737d1c4cc0abc256515aee89388ad Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 16:49:14 -0400 Subject: [PATCH 04/10] Improve collection grid archive --- test/_pages/collection-archive-grid.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/test/_pages/collection-archive-grid.html b/test/_pages/collection-archive-grid.html index 310eceeab561..2330b2cdb517 100644 --- a/test/_pages/collection-archive-grid.html +++ b/test/_pages/collection-archive-grid.html @@ -6,19 +6,23 @@ author_profile: true --- +{% assign entries_layout = page.entries_layout | default: 'list' %} {% capture written_label %}'None'{% endcapture %} {% for collection in site.collections %} {% unless collection.output == false or collection.label == "posts" %} - {% capture label %}{{ collection.label }}{% endcapture %} - {% if label != written_label %} -

{{ label }}

- {% capture written_label %}{{ label }}{% endcapture %} - {% endif %} +
+ {% capture label %}{{ collection.label }}{% endcapture %} + {% if label != written_label %} +

{{ label }}

+ {% capture written_label %}{{ label }}{% endcapture %} + {% endif %} +
+ {% for post in collection.docs %} + {% include archive-single.html type=entries_layout %} + {% endfor %} +
+ {{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} ↑ +
{% endunless %} - {% for post in collection.docs %} - {% unless collection.output == false or collection.label == "posts" %} - {% include archive-single.html type=page.entries_layout %} - {% endunless %} - {% endfor %} {% endfor %} \ No newline at end of file From d50044860fdfb06cb38959f13a72c018acc8a7a8 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 16:55:02 -0400 Subject: [PATCH 05/10] Improve page grid archive --- test/_pages/page-archive-grid.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/_pages/page-archive-grid.html b/test/_pages/page-archive-grid.html index 5b900f470259..5a23be5d172e 100644 --- a/test/_pages/page-archive-grid.html +++ b/test/_pages/page-archive-grid.html @@ -2,10 +2,15 @@ layout: archive title: "Page Archive" permalink: /page-archive-grid/ -entries_layout: grid +entries_layout: list author_profile: false --- -{% for post in site.pages %} - {% include archive-single.html type=page.entries_layout %} -{% endfor %} \ No newline at end of file +{% assign entries_layout = page.entries_layout | default: 'list' %} +
+
+ {% for post in site.pages %} + {% include archive-single.html type=entries_layout %} + {% endfor %} +
+
\ No newline at end of file From e2c5859bc242fde336b5956fe48d7cf9ab6a0f7a Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 16:55:15 -0400 Subject: [PATCH 06/10] Enable `grid` --- test/_pages/page-archive-grid.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/_pages/page-archive-grid.html b/test/_pages/page-archive-grid.html index 5a23be5d172e..68133db4de87 100644 --- a/test/_pages/page-archive-grid.html +++ b/test/_pages/page-archive-grid.html @@ -2,7 +2,7 @@ layout: archive title: "Page Archive" permalink: /page-archive-grid/ -entries_layout: list +entries_layout: grid author_profile: false --- From b0b886f3515a5cdf138675f043f47eaa45a0696d Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 4 Aug 2020 17:11:02 -0400 Subject: [PATCH 07/10] Don't show date icon if there is no `date` value --- _includes/page__meta.html | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/_includes/page__meta.html b/_includes/page__meta.html index 3dc85d63fbb6..2d7f4478a4fc 100644 --- a/_includes/page__meta.html +++ b/_includes/page__meta.html @@ -1,21 +1,19 @@ -{% assign page = post | default: page %} - -{% if page.read_time or page.show_date %} +{% assign document = post | default: page %} +{% if document.read_time or document.show_date %}

- - {% if page.show_date %} - {% assign date = page.date %} - + {% if document.show_date and document.date %} + {% assign date = document.date %} + {% endif %} - {% if page.read_time and page.show_date %}{% endif %} + {% if document.read_time and document.show_date %}{% endif %} - {% if page.read_time %} - {% assign words_per_minute = page.words_per_minute | default: site.words_per_minute | default: 200 %} - {% assign words = page.content | strip_html | number_of_words %} + {% if document.read_time %} + {% assign words_per_minute = document.words_per_minute | default: site.words_per_minute | default: 200 %} + {% assign words = document.content | strip_html | number_of_words %} - + {% if words < words_per_minute %} {{ site.data.ui-text[site.locale].less_than | default: "less than" }} 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} {% elsif words == words_per_minute %} @@ -24,6 +22,5 @@ {{ words | divided_by:words_per_minute }} {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} {% endif %} {% endif %} -

{% endif %} \ No newline at end of file From a1cffff5837c348a519c4fea2ef4b395187e4ebd Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Wed, 5 Aug 2020 09:23:12 -0400 Subject: [PATCH 08/10] Add blank line at EOF --- _includes/page__meta.html | 2 +- test/_pages/collection-archive-grid.html | 2 +- test/_pages/collection-archive.html | 2 +- test/_pages/page-archive-grid.html | 2 +- test/_pages/page-archive.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_includes/page__meta.html b/_includes/page__meta.html index 2d7f4478a4fc..1fd5f82ed39d 100644 --- a/_includes/page__meta.html +++ b/_includes/page__meta.html @@ -23,4 +23,4 @@ {% endif %} {% endif %}

-{% endif %} \ No newline at end of file +{% endif %} diff --git a/test/_pages/collection-archive-grid.html b/test/_pages/collection-archive-grid.html index 2330b2cdb517..3280bf7bdf79 100644 --- a/test/_pages/collection-archive-grid.html +++ b/test/_pages/collection-archive-grid.html @@ -25,4 +25,4 @@

{{ label }}

{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} ↑ {% endunless %} -{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/test/_pages/collection-archive.html b/test/_pages/collection-archive.html index 8eb06e0665e4..219592b6d8e9 100644 --- a/test/_pages/collection-archive.html +++ b/test/_pages/collection-archive.html @@ -20,4 +20,4 @@

{{ label }}

{% include archive-single.html type=page.entries_layout %} {% endunless %} {% endfor %} -{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/test/_pages/page-archive-grid.html b/test/_pages/page-archive-grid.html index 68133db4de87..269dc2a16403 100644 --- a/test/_pages/page-archive-grid.html +++ b/test/_pages/page-archive-grid.html @@ -13,4 +13,4 @@ {% include archive-single.html type=entries_layout %} {% endfor %} - \ No newline at end of file + diff --git a/test/_pages/page-archive.html b/test/_pages/page-archive.html index a4e515abc721..ce11172ed489 100644 --- a/test/_pages/page-archive.html +++ b/test/_pages/page-archive.html @@ -7,4 +7,4 @@ {% for post in site.pages %} {% include archive-single.html %} -{% endfor %} \ No newline at end of file +{% endfor %} From 0277056e2659ab02de88c215a812d155bc82e716 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Sat, 8 Aug 2020 13:11:48 -0400 Subject: [PATCH 09/10] Add space --- _includes/page__meta.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/page__meta.html b/_includes/page__meta.html index 1fd5f82ed39d..355ce1ee1dde 100644 --- a/_includes/page__meta.html +++ b/_includes/page__meta.html @@ -19,7 +19,7 @@ {% elsif words == words_per_minute %} 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} {% else %} - {{ words | divided_by:words_per_minute }} {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} + {{ words | divided_by: words_per_minute }} {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} {% endif %} {% endif %}

From 0b8070d559ace5cdfab2e332158eb19291b81ab2 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Sun, 30 Aug 2020 20:50:39 -0400 Subject: [PATCH 10/10] Wrap date and reading time in named `span` elements --- _includes/page__meta.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/_includes/page__meta.html b/_includes/page__meta.html index 355ce1ee1dde..1afc3d8f85eb 100644 --- a/_includes/page__meta.html +++ b/_includes/page__meta.html @@ -3,8 +3,10 @@

{% if document.show_date and document.date %} {% assign date = document.date %} - - + + + + {% endif %} {% if document.read_time and document.show_date %}{% endif %} @@ -13,14 +15,16 @@ {% assign words_per_minute = document.words_per_minute | default: site.words_per_minute | default: 200 %} {% assign words = document.content | strip_html | number_of_words %} - - {% if words < words_per_minute %} - {{ site.data.ui-text[site.locale].less_than | default: "less than" }} 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} - {% elsif words == words_per_minute %} - 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} - {% else %} - {{ words | divided_by: words_per_minute }} {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} - {% endif %} + + + {% if words < words_per_minute %} + {{ site.data.ui-text[site.locale].less_than | default: "less than" }} 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} + {% elsif words == words_per_minute %} + 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} + {% else %} + {{ words | divided_by: words_per_minute }} {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }} + {% endif %} + {% endif %}

{% endif %}