Fix bug where some pages where not shown as tiles.
This commit refactors the `tiles.html` include file so that when the
`site.tiles-source` is pages, pages with `show_tile: false` set in their
Front Matter are not counted as having been shown. Prior to this commit,
such pages were iterated over in the `for` loop, consuming a loop
iteration from the `site.tiles-count` counter.
Put another way, say you have set `tiles-count` to 6, and you have a
total of 10 pages. Of these ten pages, six have `show_tile` set to
`false`. The natural expectation would be that the home page layout
would display four tiles (10 - 6 = 4), but in fact, the exact number of
page tiles shown would depend on the specific lexicographical ordering
of the `site.html_pages` array, which could result in fewer than four
page tiles being shown.
This commit fixes the issue by excluding pages with `show_tile` set to
`false` first, and only then iterating over the remaining pages.
2020-01-31 19:21:40 +00:00
|
|
|
{% if 'posts' == site.tiles-source %}
|
|
|
|
{% assign tiles = site.posts %}
|
|
|
|
{% elsif 'pages' == site.tiles-source %}
|
|
|
|
{% assign tiles = site.html_pages | where_exp: "item", "item.show_tile != false" %}
|
|
|
|
{% endif %}
|
2016-08-25 23:15:01 +00:00
|
|
|
<section id="one" class="tiles">
|
Fix bug where some pages where not shown as tiles.
This commit refactors the `tiles.html` include file so that when the
`site.tiles-source` is pages, pages with `show_tile: false` set in their
Front Matter are not counted as having been shown. Prior to this commit,
such pages were iterated over in the `for` loop, consuming a loop
iteration from the `site.tiles-count` counter.
Put another way, say you have set `tiles-count` to 6, and you have a
total of 10 pages. Of these ten pages, six have `show_tile` set to
`false`. The natural expectation would be that the home page layout
would display four tiles (10 - 6 = 4), but in fact, the exact number of
page tiles shown would depend on the specific lexicographical ordering
of the `site.html_pages` array, which could result in fewer than four
page tiles being shown.
This commit fixes the issue by excluding pages with `show_tile` set to
`false` first, and only then iterating over the remaining pages.
2020-01-31 19:21:40 +00:00
|
|
|
{% for tile in tiles limit:site.tiles-count %}
|
2018-08-05 18:35:00 +00:00
|
|
|
<article>
|
|
|
|
<span class="image">
|
Fix bug where some pages where not shown as tiles.
This commit refactors the `tiles.html` include file so that when the
`site.tiles-source` is pages, pages with `show_tile: false` set in their
Front Matter are not counted as having been shown. Prior to this commit,
such pages were iterated over in the `for` loop, consuming a loop
iteration from the `site.tiles-count` counter.
Put another way, say you have set `tiles-count` to 6, and you have a
total of 10 pages. Of these ten pages, six have `show_tile` set to
`false`. The natural expectation would be that the home page layout
would display four tiles (10 - 6 = 4), but in fact, the exact number of
page tiles shown would depend on the specific lexicographical ordering
of the `site.html_pages` array, which could result in fewer than four
page tiles being shown.
This commit fixes the issue by excluding pages with `show_tile` set to
`false` first, and only then iterating over the remaining pages.
2020-01-31 19:21:40 +00:00
|
|
|
<img src="{{ tile.image }}" alt="" />
|
2018-08-05 18:35:00 +00:00
|
|
|
</span>
|
|
|
|
<header class="major">
|
Fix bug where some pages where not shown as tiles.
This commit refactors the `tiles.html` include file so that when the
`site.tiles-source` is pages, pages with `show_tile: false` set in their
Front Matter are not counted as having been shown. Prior to this commit,
such pages were iterated over in the `for` loop, consuming a loop
iteration from the `site.tiles-count` counter.
Put another way, say you have set `tiles-count` to 6, and you have a
total of 10 pages. Of these ten pages, six have `show_tile` set to
`false`. The natural expectation would be that the home page layout
would display four tiles (10 - 6 = 4), but in fact, the exact number of
page tiles shown would depend on the specific lexicographical ordering
of the `site.html_pages` array, which could result in fewer than four
page tiles being shown.
This commit fixes the issue by excluding pages with `show_tile` set to
`false` first, and only then iterating over the remaining pages.
2020-01-31 19:21:40 +00:00
|
|
|
<h3><a href="{{ tile.url | relative_url }}" class="link">{{ tile.title }}</a></h3>
|
2018-08-05 18:35:00 +00:00
|
|
|
<p>{{ post.description }}</p>
|
|
|
|
</header>
|
|
|
|
</article>
|
|
|
|
{% endfor %}
|
2016-08-25 23:15:01 +00:00
|
|
|
</section>
|