@ -121,7 +122,6 @@ Configura `paginate_by` al front matter del teu arxiu `content/_index.md`:
```toml
```toml
title = "Últimes publicacions"
title = "Últimes publicacions"
sort_by = "date"
sort_by = "date"
template = "section.html"
paginate_by = 5 # Mostra 5 publicacions per pàgina.
paginate_by = 5 # Mostra 5 publicacions per pàgina.
[extra]
[extra]
@ -137,7 +137,6 @@ Utilitza `section_path` a la secció `[extra]` del teu arxiu `content/_index.md`
```toml
```toml
title = "Últimes publicacions"
title = "Últimes publicacions"
sort_by = "date"
sort_by = "date"
template = "section.html"
# No configuris `paginate_by` aquí.
# No configuris `paginate_by` aquí.
[extra]
[extra]
@ -153,6 +152,23 @@ Notes addicionals:
- El `title` al front matter estableix el títol que apareix sobre les publicacions.
- El `title` al front matter estableix el títol que apareix sobre les publicacions.
- Utilitza la ruta completa a l'arxiu `_index.md` de la secció per a `section_path`. Usar `section_path = "blog/"` no funcionarà.
- Utilitza la ruta completa a l'arxiu `_index.md` de la secció per a `section_path`. Usar `section_path = "blog/"` no funcionarà.
##### Fixar entrades
Pots fixar entrades per mantenir-les a la part superior de la pàgina principal. En aquesta demo, aquesta entrada està fixada, així que apareix primera amb una icona i etiqueta de "fixada":
Les entrades fixades es mostren primer, mantenint el seu ordre relatiu segons el `sort_by` de la secció, seguides per les entrades regulars.
Per fixar una entrada, afegeix el següent al seu front matter:
```toml
[extra]
pinned = true
```
{{ admonition(type="note", text="Aquesta configuració només afecta les pàgines que utilitzen la plantilla predeterminada `section.html`. En aquesta demo, això inclou la pàgina principal i `blog/`. Altres seccions —pàgines d'etiquetes, `archive/` o sèries— ignoren aquesta configuració.") }}
##### Mostrar la data dels articles al llistat
##### Mostrar la data dels articles al llistat
Per defecte, quan es llisten els articles, es mostra la data de creació. Pots configurar quina(es) data(es) mostrar utilitzant l'opció `post_listing_date`. Configuracions disponibles:
Per defecte, quan es llisten els articles, es mostra la data de creació. Pots configurar quina(es) data(es) mostrar utilitzant l'opció `post_listing_date`. Configuracions disponibles:
@ -121,7 +122,6 @@ Configura `paginate_by` en el front matter de tu archivo `content/_index.md`:
```toml
```toml
title = "Últimas publicaciones"
title = "Últimas publicaciones"
sort_by = "date"
sort_by = "date"
template = "section.html"
paginate_by = 5 # Muestra 5 publicaciones por página.
paginate_by = 5 # Muestra 5 publicaciones por página.
[extra]
[extra]
@ -137,7 +137,6 @@ Utiliza `section_path` en la sección `[extra]` de tu archivo `content/_index.md
```toml
```toml
title = "Últimas publicaciones"
title = "Últimas publicaciones"
sort_by = "date"
sort_by = "date"
template = "section.html"
# No configures `paginate_by` aquí.
# No configures `paginate_by` aquí.
[extra]
[extra]
@ -153,6 +152,23 @@ Notas adicionales:
- El `title` en el front matter establece el título que aparece sobre las publicaciones.
- El `title` en el front matter establece el título que aparece sobre las publicaciones.
- Usa la ruta completa al archivo `_index.md` de la sección para `section_path`. Usar `section_path = "blog/"` no funcionará.
- Usa la ruta completa al archivo `_index.md` de la sección para `section_path`. Usar `section_path = "blog/"` no funcionará.
##### Fijar publicaciones
Puedes fijar publicaciones para mantenerlas en la parte superior de la página principal. En esta demo, esta publicación está fijada, por lo que aparece primera con un icono y etiqueta de "fijada":
Las publicaciones fijadas se muestran primero, manteniendo su orden relativo según el `sort_by` de la sección, seguidas por el resto de las publicaciones.
Para fijar una publicación, añade lo siguiente a su front matter:
```toml
[extra]
pinned = true
```
{{ admonition(type="note", text='Este ajuste solo afecta a las páginas que usan la plantilla predeterminada `section.html`. En esta demo, esto incluye la página principal y `blog/`. Otras secciones —páginas de etiquetas, `archive/` o series— ignoran este ajuste.') }}
##### Mostrar la fecha de los artículos en el listado
##### Mostrar la fecha de los artículos en el listado
Por defecto, cuando se listan los artículos, se muestra la fecha de creación. Puedes configurar qué fecha(s) mostrar usando la opción `post_listing_date`. Configuraciones disponibles:
Por defecto, cuando se listan los artículos, se muestra la fecha de creación. Puedes configurar qué fecha(s) mostrar usando la opción `post_listing_date`. Configuraciones disponibles:
@ -121,7 +122,6 @@ Set `paginate_by` in the front matter of your `content/_index.md` file:
```toml
```toml
title = "Latest posts"
title = "Latest posts"
sort_by = "date"
sort_by = "date"
template = "section.html"
paginate_by = 5 # Show 5 posts per page.
paginate_by = 5 # Show 5 posts per page.
[extra]
[extra]
@ -137,7 +137,6 @@ Use `section_path` in the `[extra]` section of your `content/_index.md` file:
```toml
```toml
title = "Latest posts"
title = "Latest posts"
sort_by = "date"
sort_by = "date"
template = "section.html"
# Do not set `paginate_by` here.
# Do not set `paginate_by` here.
[extra]
[extra]
@ -153,6 +152,23 @@ Additional notes:
- The `title` in the front matter sets the header that appears above the posts.
- The `title` in the front matter sets the header that appears above the posts.
- Use the full path to the section's `_index.md` file for `section_path`. Using `section_path = "blog/"` will not work.
- Use the full path to the section's `_index.md` file for `section_path`. Using `section_path = "blog/"` will not work.
##### Pinning Posts
You can pin posts to keep them at the top of the main page listing. In this demo, this post is pinned, so it appears first with a "pinned" icon and label:
Pinned posts are shown first, maintaining their relative order of the section's `sort_by`, followed by regular posts.
To pin a post, add the following to its front matter:
```toml
[extra]
pinned = true
```
{{ admonition(type="note", text='This setting only affects pages using the default `section.html` template. In this demo, this includes the main page and `blog/`. Other sections —tags, archives, or series pages— ignore this setting.') }}
##### Display the Date of Posts in Listing
##### Display the Date of Posts in Listing
By default, when listing posts, the date of post creation is shown. You can configure which date(s) to display using the `post_listing_date` option. Available settings:
By default, when listing posts, the date of post creation is shown. You can configure which date(s) to display using the `post_listing_date` option. Available settings:
{% set all_posts = pinned_posts | concat(with=regular_posts) %}
{% else %}
{% set all_posts = posts %}
{% endif %}
<divclass="bloglist-container">
{# Display all posts (pinned first, then regular) #}
{% for post in all_posts %}
{% if loop.index <= max %}
{% if loop.index <= max %}
{% if loop.index == max or loop.last %}
{% if loop.index == max or loop.last %}
{% set bottom_divider = false %}
{% set bottom_divider = false %}
@ -16,81 +34,90 @@
{% set bottom_divider = true %}
{% set bottom_divider = true %}
{% endif %}
{% endif %}
<sectionclass="bloglist-meta {% if bottom_divider -%}bottom-divider{%- endif -%}">
<sectionclass="bloglist-meta {% if bottom_divider -%}bottom-divider{%- endif -%}">
<ul>
<ul>
{%- if "indexes" in metadata -%}
{%- if "indexes" in metadata -%}
{%- set post_index = loop.index -%}
{%- set post_index = loop.index -%}
{%- set nb_posts = posts | length -%}
{%- set number_of_posts = posts | length -%}
{# in case we have a pager, the index has been computed for the current page. #}
{# in case we have a pager, the index has been computed for the current page. #}
{%- if paginator -%}
{%- if paginator -%}
{%- set nb_posts = paginator.total_pages -%}
{%- set number_of_posts = paginator.total_pages -%}
{%- set number_of_other_pages = paginator.current_index - 1 -%}
{%- set number_of_other_pages = paginator.current_index - 1 -%}
{%- set posts_per_page = paginator.paginate_by -%}
{%- set posts_per_page = paginator.paginate_by -%}
{%- set posts_in_other_pages = number_of_other_pages * posts_per_page -%}
{%- set posts_in_other_pages = number_of_other_pages * posts_per_page -%}
{%- set post_index = posts_in_other_pages + post_index -%}
{%- set post_index = posts_in_other_pages + post_index -%}
{%- endif -%}
{%- endif -%}
{%- if macros_settings::evaluate_setting_priority(setting="post_listing_index_reversed", page=section, default_global_value=false) == "true" -%}
{%- if macros_settings::evaluate_setting_priority(setting="post_listing_index_reversed", page=section, default_global_value=false) == "true" -%}
{# index starts at 1 instead of 0 #}
{# index starts at 1 instead of 0 #}
{%- set post_index = nb_posts + 1 - post_index -%}
{%- set post_index = number_of_posts + 1 - post_index -%}
{%- endif -%}
{%- endif -%}
<liclass="index-label">{{ post_index }}</li>
<liclass="index-label">{{ post_index }}</li>
{%- endif -%}
{%- if "dates" in metadata -%}
{%- set allowed_post_listing_dates = ["date", "updated", "both"] -%}
{%- set post_listing_date = config.extra.post_listing_date | default(value="date") -%}
{%- if post_listing_date not in allowed_post_listing_dates -%}
{{ throw(message="ERROR: Invalid value for config.extra.post_listing_date. Allowed values are 'date', 'updated', or 'both'.") }}
{%- endif -%}
{%- endif -%}
{%- set show_date = post.date and post_listing_date == "date" or post.date and post_listing_date == "both" or post.date and post_listing_date == "updated" and not post.updated -%}
{%- if "dates" in metadata -%}
{%- set show_updated = post.updated and post_listing_date == "updated" or post.updated and post_listing_date == "both" -%}
{%- set allowed_post_listing_dates = ["date", "updated", "both"] -%}
{%- set post_listing_date = config.extra.post_listing_date | default(value="date") -%}
{%- if show_date or show_updated -%}
{%- if post_listing_date not in allowed_post_listing_dates -%}
{%- if show_date -%}
{{ throw(message="ERROR: Invalid value for config.extra.post_listing_date. Allowed values are 'date', 'updated', or 'both'.") }}
{%- set show_date = post.date and post_listing_date == "date" or post.date and post_listing_date == "both" or post.date and post_listing_date == "updated" and not post.updated -%}
{%- endif -%}
{%- set show_updated = post.updated and post_listing_date == "updated" or post.updated and post_listing_date == "both" -%}
{%- if show_updated -%}
{%- set last_updated_str = macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -%}
{%- if show_date or show_updated -%}
{%- set formatted_date = macros_format_date::format_date(date=post.updated, short=true, language_strings=language_strings) -%}
{%- if show_date -%}
{%- set updated_str = last_updated_str | replace(from="$DATE", to=formatted_date) -%}