feat: add option to display/hide date in metadata (#306)

main
Óscar 10 months ago committed by GitHub
parent 5bc593b676
commit 0cbd727f25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -132,6 +132,10 @@ copy_button = true
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_reading_time = true
# Show the date of a page below its title.
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_date = true
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
footnote_backlinks = false

@ -1,7 +1,7 @@
+++
title = "Domina la configuració de tabi: guia completa"
date = 2023-09-18
updated = 2024-04-23
updated = 2024-05-02
description = "Descobreix les múltiples maneres en què pots personalitzar tabi."
[taxonomies]
@ -698,6 +698,14 @@ Pots activar o desactivar el temps estimat de lectura d'un article amb `show_rea
Com que segueix [la jerarquia](#jerarquia-de-configuracio), pots activar-lo o desactivar-lo per a pàgines o seccions específiques. Per exemple, aquesta demo desactiva `show_reading_time = false` a la secció [projectes](https://welpo.github.io/tabi/ca/projects/) a l'arxiu [`_index.md`](https://github.com/welpo/tabi/blob/main/content/projects/_index.es.md?plain=1), de manera que les seves publicacions individuals no mostren el temps de lectura.
### Mostrar la data
| Pàgina | Secció | `config.toml` | Segueix la jerarquia | Requereix JavaScript |
|:------:|:------:|:-------------:|:--------------------:|:-------------------:|
| ✅ | ✅ | ✅ | ✅ | ❌ |
Per defecte, la data es mostra sota el títol de la publicació. Pots amagar-la amb `show_date = false`. Aquest ajust segueix [la jerarquia](#jerarquia-de-configuracio).
### Format de data
| Pàgina | Secció | `config.toml` | Segueix la jerarquia | Requereix JavaScript |

@ -1,7 +1,7 @@
+++
title = "Domina la configuración de tabi: guía completa"
date = 2023-09-18
updated = 2024-04-23
updated = 2024-05-02
description = "Descubre las múltiples maneras en que puedes personalizar tabi."
[taxonomies]
@ -700,6 +700,14 @@ Puedes activar o desactivar el tiempo estimado de lectura de un artículo con `s
Dado que sigue [la jerarquía](#jerarquia-de-configuracion), puedes activarlo o desactivarlo para páginas o secciones específicas. Por ejemplo, esta demo desactiva `show_reading_time = false` en la sección [proyectos](https://welpo.github.io/tabi/es/projects/) en el archivo [`_index.md`](https://github.com/welpo/tabi/blob/main/content/projects/_index.es.md?plain=1), por lo que sus publicaciones individuales no muestran el tiempo de lectura.
### Mostrar la fecha
| Página | Sección | `config.toml` | Sigue la jerarquía | Requiere JavaScript |
|:------:|:-------:|:-------------:|:------------------:|:-------------------:|
| ✅ | ✅ | ✅ | ✅ | ❌ |
Por defecto, la fecha se muestra debajo del título de la publicación. Puedes ocultarla con `show_date = false`. Esta configuración sigue [la jerarquía](#jerarquia-de-configuracion).
### Formato de fecha
| Página | Sección | `config.toml` | Sigue la jerarquía | Requiere JavaScript |

@ -1,7 +1,7 @@
+++
title = "Mastering tabi Settings: A Comprehensive Guide"
date = 2023-09-18
updated = 2024-04-23
updated = 2024-05-02
description = "Discover the many ways you can customise your tabi site."
[taxonomies]
@ -705,6 +705,14 @@ You can enable or hide the reading time of a post with `show_reading_time`. If y
Since it follows [the hierarchy](#settings-hierarchy), you can enable it or hide it for specific pages or sections. For example, this demo sets `show_reading_time = false` in the [projects](https://welpo.github.io/tabi/projects/) section's [`_index.md`](https://github.com/welpo/tabi/blob/main/content/projects/_index.md?plain=1), so their individual posts don't show the reading time.
### Show Date
| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript |
|:----:|:-------:|:-------------:|:-----------------:|:-------------------:|
| ✅ | ✅ | ✅ | ✅ | ❌ |
By default, the date is shown below the post title. You can hide it with `show_date = false`. This setting follows [the hierarchy](#settings-hierarchy).
### Date Format
| Page | Section | `config.toml` | Follows Hierarchy | Requires JavaScript |

@ -20,6 +20,7 @@
"katex",
"quick_navigation_buttons",
"show_reading_time",
"show_date",
"show_remote_changes",
"toc",
"show_previous_next_article_links",
@ -64,17 +65,20 @@
<li class="draft-label">{{ macros_translate::translate(key="draft", default="DRAFT", language_strings=language_strings) }}</li>
{% endif %}
{% if page.date %}
{# page settings override config settings #}
{% if page.date and macros_settings::evaluate_setting_priority(setting="show_date", page=page, default_global_value=true) == "true" %}
<li>{{ macros_format_date::format_date(date=page.date, short=true, language_strings=language_strings) }}</li>
{#- Variable to keep track of whether we've shown a section, to avoid separators as the first element -#}
{%- set previous_visible = true -%}
{% endif %}
{# page settings override config settings #}
{% if macros_settings::evaluate_setting_priority(setting="show_reading_time", page=page, default_global_value=true) == "true" %}
{{ separator }} <li title="{{ macros_translate::translate(key="words", number=page.word_count, default="$NUMBER words", language_strings=language_strings) }}">{{ macros_translate::translate(key="min_read", number=page.reading_time, default="$NUMBER min read", language_strings=language_strings) }}</li>
{%- if previous_visible -%}{{ separator }}&nbsp;{%- endif -%}<li title="{{ macros_translate::translate(key="words", number=page.word_count, default="$NUMBER words", language_strings=language_strings) }}">{{ macros_translate::translate(key="min_read", number=page.reading_time, default="$NUMBER min read", language_strings=language_strings) }}</li>
{%- set previous_visible = true -%}
{% endif %}
{%- if page.taxonomies and page.taxonomies.tags -%}
{{ separator }}&nbsp;<li>{{- macros_translate::translate(key="tags", default="tags", language_strings=language_strings) | capitalize -}}:&nbsp;</li>
{%- if previous_visible -%}&nbsp;{{ separator }}&nbsp;{%- endif -%}<li>{{- macros_translate::translate(key="tags", default="tags", language_strings=language_strings) | capitalize -}}:&nbsp;</li>
{%- for tag in page.taxonomies.tags -%}
<li><a href={{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}>{{ tag }}</a>
{%- if not loop.last -%}
@ -82,13 +86,14 @@
{%- endif -%}
</li>
{%- endfor -%}
{%- set previous_visible = true -%}
{%- endif -%}
{% if page.updated %}
</ul><ul class="meta last-updated"><li>{{ macros_translate::translate(key="last_updated_on", default="Last updated on", language_strings=language_strings) }} {{ macros_format_date::format_date(date=page.updated, short=true, language_strings=language_strings) }}</li>
{# Show link to remote changes if enabled #}
{% if config.extra.remote_repository_url and macros_settings::evaluate_setting_priority(setting="show_remote_changes", page=page, default_global_value=true) == "true" %}
{{ separator }}
{%- if previous_visible -%}{{ separator }}&nbsp;{%- endif -%}
<li><a href="{% include "partials/history_url.html" %}" {{ blank_target }} rel="{{ rel_attributes }}">{{ macros_translate::translate(key="see_changes", default="See changes", language_strings=language_strings) }}<small>&nbsp;<span class="arrow-corner"></span></small></a></li>
{% endif %}
{% endif %}

@ -87,6 +87,10 @@ copy_button = true
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_reading_time = true
# Show the date of a page below its title.
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_date = true
# Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
footnote_backlinks = false

Loading…
Cancel
Save