dependabot-preview[bot] on cargo
dependabot-preview[bot] on cargo
build(deps): bump serde_yaml fr… (compare)
dependabot-preview[bot] on cargo
build(deps): bump liquid from 0… (compare)
dependabot-preview[bot] on cargo
build(deps): bump assert_fs fro… (compare)
committed
that will error if a fix
, feat
, or BREAKING CHANGE
commit does not include a change in the changelog.
Current status of cobalt: On pause for a little bit.
I got unblocked on some other programs so I'm trying to get that out of the way so I won't be distracted from cobalt development.
For when I'm back, my focus is on the next
branch where I'm doing a major re-architecture. The primary goal is to make it easier to add new features but I hope to also get a performance boost
---
pagination:
include: All
per_page: 5
order: Desc
sort_by: ["published_date"]
---
<div class="sidebar ">
<h2>Recent Posts</h2>
<ul>
{% for ppost in paginator.pages limit:5 %}
<li><a href="{{ site.base_url}}{{ ppost.permalink }}">{{ ppost.title }}</a></li>
{% endfor %}
</ul>
</div>
<div class="sidebar">
<h2>Tags</h2>
<ul>
{% for ptag in paginator.indexes %}
<li><a href="/{{ ptag.index_permalink }}/">{{ ptag.index_title }}</a></li>
{% endfor %}
</ul>
</div>
OK, I decided to remove the sidebar, but of course I had to figure out how to get a more bootstrap-canonical paginator, which is outside the documentation (of course). This is what I'm attempting (but I've tried a number of variants):
<nav aria-label="Page navigation">
{% capture startIndex %}{{ paginator.index | minus: 2 | at_least: 0 }}{% endcapture %}
{% capture maxIndex %}{{ paginator.total_indexes | minus: 1 }}{% endcapture %}
{% capture currIndex %}{{ paginator.index | minus: 1 }}{% endcapture %}
{% capture endIndex %}{{ paginator.index | plus: 2 | at_most: maxIndex }}{% endcapture %}
<ul class="pagination">
{% if paginator.previous_index %}
<li class="page-item">
<a class="page-link" href="{{ paginator.previous_index_permalink }}" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
{% endif %}
{% for pgIndex in (startIndex..endIndex) %}
<li class="page-item">
{% if pgIndex == currIndex %}
<a class="page-link" href="{{ paginator.index_permalink }}">{{ paginator.index }}</a>
{% else %}
<a class="page-link" href="{{ paginator.pages[pgIndex].permalink}}">{{ pgIndex | plus: 1 }}</a>
{% endif %}
</li>
{% endfor %}
{% if paginator.next_index %}
<li class="page-item">
<a class="page-link" href="{{ paginator.next_index_permalink }}" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
{% endif %}
</ul>
</nav>
And the error I get:
Error: build command failed
Info: caused by Failed to render content for blog/archive.html
Info: caused by liquid: Unknown index
with:
variable=paginator.pages
requested index=1
available indexes=0, first, last
from: {{% else %}}
from: {% if pgIndex == currIndex %}
from: {% for pgIndex in (startIndex..endIndex) %}
with:
index=2
Is there an obvious, easy fix that I'm somehow missing? Or is this a bug in cobalt?
Otherwise to give you some inspiration, this is how I'm using it:
---
permalink: /
published_date: "2018-02-10 21:57:48 +0000"
layout: default.liquid
is_draft: false
pagination:
include: All
per_page: 5
---
<div class="catalogue">
{% for page in paginator.pages %}
<div class="catalogue-item">
<a href="/{{ page.permalink }}" class="fill-div"></a>
<time datetime="{% include date_fr.liquid %}" class="catalogue-time">{% include date_fr.liquid %}</time>
<h1 class="catalogue-title">{{ page.title }}</h1>
<div class="catalogue-line"></div>
<p>
{{ page.excerpt }}
</p>
<span class="fas fa-clock eta"></span>{% include reading_time.liquid %}
{% if page.tags %}<span class="fa fa-tags" style="margin-left: 8px;"></span>{% include print_tags.liquid %}{% endif %}
</div>
{% endfor %}
</div>
{% include nav_pagination.liquid %}
</div>
and nav_pagination.liquid:
<div class="pagination">
{% if paginator.previous_index %}
<span class="left arrow">
<a class="one_arrow"
href="/{{ paginator.previous_index_permalink }}">Page précédente</a>
</span>
{% endif %}
{% if paginator.next_index %}
<span class="right arrow">
<a class="one_arrow"
href="/{{ paginator.next_index_permalink }}">Page suivante</a>
</span>
{% endif %}
<div style="width: 100%; text-align: center;">{{ paginator.index }} / {{ paginator.total_indexes }}</div>
<div>
{% if paginator.previous_index %}
<span class="end_left arrow one_arrow">
<a style="font-size: 75%; vertical-align: 15%;"
href="/{{ paginator.first_index_permalink }}">Première page</a>
</span>
{% endif %}
{% if paginator.next_index %}
<span class="end_right arrow one_arrow">
<a style="font-size: 75%; vertical-align: 15%;"
href="/{{ paginator.last_index_permalink }}">
Dernière page</a>
</span>
{% endif %}
Yeah, the way you have your paginator setup works, @Geobert , but Bootstrap does things differently. A bit more like:
< 2 3 4 5 6 >
[info] Building from "I:\\Dev\\blog_test\\src" into "I:\\Dev\\blog_test\\_site"
Error: build command failed
Info: caused by Failed to render content for all/3/index.html
Info: caused by liquid: Unknown index
with:
variable=paginator.pages
requested index=5
available indexes=0, 1, 2, 3, 4, first, last
from: {{% else %}}
from: {% if pgIndex == currIndex %}
from: {% for pgIndex in (startIndex..endIndex) %}
with:
index=5
from: {% include nav_pagination.liquid %}
with:
nav_pagination.liquid=nav_pagination.liquid
All
as well, but it's the only way to distinguish a meta paginator from a paginator (testing the existence of indexes
)