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/page__meta.html b/_includes/page__meta.html new file mode 100644 index 000000000000..1afc3d8f85eb --- /dev/null +++ b/_includes/page__meta.html @@ -0,0 +1,30 @@ +{% assign document = post | default: page %} +{% if document.read_time or document.show_date %} +

+ {% if document.show_date and document.date %} + {% assign date = document.date %} + + + + + {% endif %} + + {% if document.read_time and document.show_date %}{% endif %} + + {% 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 %} + 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 %} diff --git a/_includes/post__meta.html b/_includes/post__meta.html deleted file mode 100644 index 1ea81e5bbcba..000000000000 --- a/_includes/post__meta.html +++ /dev/null @@ -1,35 +0,0 @@ -{% assign page = post | default: page %} - -{% if page.read_time or page.show_date %} -

- - {% if page.show_date %} - {% assign date = page.date %} - - - {% endif %} - - {% if page.read_time and page.show_date %} - {% if include.type == "grid" %} -
- {% else %} - - {% endif %} - {% 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 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 %} \ No newline at end of file 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 %} 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; 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..3280bf7bdf79 --- /dev/null +++ b/test/_pages/collection-archive-grid.html @@ -0,0 +1,28 @@ +--- +layout: archive +title: "Posts by Collection (grid view)" +permalink: /collection-archive-grid/ +entries_layout: grid +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 %} +
+ {% 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 %} +{% endfor %} diff --git a/test/_pages/collection-archive.html b/test/_pages/collection-archive.html index 80d281642917..219592b6d8e9 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 +{% endfor %} 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..269dc2a16403 --- /dev/null +++ b/test/_pages/page-archive-grid.html @@ -0,0 +1,16 @@ +--- +layout: archive +title: "Page Archive" +permalink: /page-archive-grid/ +entries_layout: grid +author_profile: false +--- + +{% assign entries_layout = page.entries_layout | default: 'list' %} +
+
+ {% for post in site.pages %} + {% include archive-single.html type=entries_layout %} + {% endfor %} +
+
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 %} 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 +---