You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we use the next_page / prev_page code it returns the next/prev page as specified by the config.yml configuration file
If we have
content/blog
- page a
- page c
content/foo
- page b
then the alpha order is
- blog/page a
- foo/page b
- blog/page c
But for me it make no sense to have this order if I would navigate only the blog content (similar issue if we use the date sort).
So another level of configuration is needed, my 2 cents. pages_order_by:meta/alpha/date/subdir
In twig is something like this:
{% set next_this = '' %}
{% set prev_this = '' %}
{% set n = '' %}
{% set p = '' %}
{% for page in pages(mysubdir)|sort_by(date)|reverse %}
{% if current_page.id == page.id %}
{% set n = (loop.index-1) %}
{% set p = (loop.index+1) %}
{% endif %}
{% endfor %}
{% for page in pages(mysubdir)|sort_by(date)|reverse %}
{% if n == loop.index %}
{% set next_this = page %}
{% endif %}
{% if p == loop.index %}
{% set prev_this = page %}
{% endif %}
{% endfor %}
«{{ next_this.title}} ... {{ prev_this.title}}»
The text was updated successfully, but these errors were encountered:
Alpha order is going to be blog/page a, blog/page c and foo/page b, as pages aren't just sorted by their basename, but the full path. If you want it to roll over at the directory boundary, use the pages() function and sort_by filter (as you did, even though you don't need two iterations). pages_order is for the global page order. Directories don't have any special meaning in Pico on purpose, as we want users to organize their pages how they prefer.
See #615 for an extensive discussion about this and various Twig snippets
When we use the
next_page / prev_page
code it returns the next/prev page as specified by the config.yml configuration fileIf we have
then the alpha order is
But for me it make no sense to have this order if I would navigate only the blog content (similar issue if we use the date sort).
So another level of configuration is needed, my 2 cents.
pages_order_by:
meta
/alpha
/date
/subdirIn twig is something like this:
The text was updated successfully, but these errors were encountered: