From 2080469952cbde9325dfbb721f5b33b0612d243d Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Tue, 5 Sep 2017 13:02:37 -0400 Subject: [PATCH] Show 4 latest posts when `site.related_posts` is `nil` `site.related_posts` should return an array of latest posts when no related ones are found due to `lsi` being disabled (GitHub Page's doesn't support it). This works around that bug by showing the 4 latest posts to populate the "You May Also Enjoy" module when enabled with `related: true`. Fixes #554 Related: #978 #1022 --- CHANGELOG.md | 1 + _layouts/single.html | 12 +++++++++++- docs/_docs/18-history.md | 3 ++- docs/_layouts/single.html | 12 +++++++++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91e8d541..b13eb1dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Improve Chinese `date_label` and `minute_read` translations in `ui-text.yml`. [#1205](https://github.com/mmistakes/minimal-mistakes/pull/1205) [#1211](https://github.com/mmistakes/minimal-mistakes/pull/1211) - Add note to Quick-Start Guide about GitHub Pages hosting alternatives that allow 3rd party gem themes and Jekyll plugins. - Add note to configuration documentation about Cloudflare minification as an alternative to `layout: compress`. [#1217](https://github.com/mmistakes/minimal-mistakes/pull/1217) +- Show 4 latest posts in "You May Also Enjoy" module when `related: true` and no related posts are found due to `lsi` ([latent semantic indexing](https://en.wikipedia.org/wiki/Latent_semantic_analysis#Latent_semantic_indexing)) being disabled on GitHub Pages. [#554](https://github.com/mmistakes/minimal-mistakes/issues/554) ### Bug Fixes diff --git a/_layouts/single.html b/_layouts/single.html index 826e9b17..7d327352 100644 --- a/_layouts/single.html +++ b/_layouts/single.html @@ -60,7 +60,7 @@ layout: default {% endif %} - {% comment %}{% endcomment %} + {% comment %}{% endcomment %} {% if page.id and page.related and site.related_posts.size > 0 %} + {% comment %}{% endcomment %} + {% elsif page.id and page.related %} + {% endif %} diff --git a/docs/_docs/18-history.md b/docs/_docs/18-history.md index a8af0bf5..76888604 100644 --- a/docs/_docs/18-history.md +++ b/docs/_docs/18-history.md @@ -4,7 +4,7 @@ permalink: /docs/history/ excerpt: "Change log of enhancements and bug fixes made to the theme." sidebar: nav: docs -last_modified_at: 2017-09-05T12:07:50-04:00 +last_modified_at: 2017-09-05T12:58:56-04:00 --- ## Unreleased @@ -20,6 +20,7 @@ last_modified_at: 2017-09-05T12:07:50-04:00 - Improve Chinese `date_label` and `minute_read` translations in `ui-text.yml`. [#1205](https://github.com/mmistakes/minimal-mistakes/pull/1205) [#1211](https://github.com/mmistakes/minimal-mistakes/pull/1211) - Add note to Quick-Start Guide about GitHub Pages hosting alternatives that allow 3rd party gem themes and Jekyll plugins. - Add note to configuration documentation about Cloudflare minification as an alternative to `layout: compress`. [#1217](https://github.com/mmistakes/minimal-mistakes/pull/1217) +- Show 4 latest posts in "You May Also Enjoy" module when `related: true` and no related posts are found due to `lsi` ([latent semantic indexing](https://en.wikipedia.org/wiki/Latent_semantic_analysis#Latent_semantic_indexing)) being disabled on GitHub Pages. [#554](https://github.com/mmistakes/minimal-mistakes/issues/554) ### Bug Fixes diff --git a/docs/_layouts/single.html b/docs/_layouts/single.html index 826e9b17..7d327352 100644 --- a/docs/_layouts/single.html +++ b/docs/_layouts/single.html @@ -60,7 +60,7 @@ layout: default {% endif %} - {% comment %}{% endcomment %} + {% comment %}{% endcomment %} {% if page.id and page.related and site.related_posts.size > 0 %} + {% comment %}{% endcomment %} + {% elsif page.id and page.related %} + {% endif %}