✨ feat(comments): allow page override of global system (#216)
This commit is contained in:
parent
05ab241002
commit
de28c7fdeb
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Domina la configuració de tabi: guia completa"
|
title = "Domina la configuració de tabi: guia completa"
|
||||||
date = 2023-09-18
|
date = 2023-09-18
|
||||||
updated = 2023-10-05
|
updated = 2023-10-27
|
||||||
description = "Descobreix les múltiples maneres en què pots personalitzar tabi."
|
description = "Descobreix les múltiples maneres en què pots personalitzar tabi."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -454,6 +454,8 @@ Per activar els comentaris en una pàgina, establert el nom del sistema com a `t
|
|||||||
|
|
||||||
Si vols activar els comentaris de forma global, pots fer-ho establint `enabled_for_all_posts = true` a la secció apropiada del teu `config.toml` (per exemple, a `[extra.giscus]`).
|
Si vols activar els comentaris de forma global, pots fer-ho establint `enabled_for_all_posts = true` a la secció apropiada del teu `config.toml` (per exemple, a `[extra.giscus]`).
|
||||||
|
|
||||||
|
Si has activat un sistema de forma global i vols desactivar-lo per a una pàgina específica, pots fer-ho establint el nom del sistema com a `false` al front matter. Per exemple, `utterances = false`.
|
||||||
|
|
||||||
Llegeix la [documentació](/ca/blog/comments/) per a més informació sobre els sistemes disponibles i la seva configuració.
|
Llegeix la [documentació](/ca/blog/comments/) per a més informació sobre els sistemes disponibles i la seva configuració.
|
||||||
|
|
||||||
### Anàlisi web
|
### Anàlisi web
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Domina la configuración de tabi: guía completa"
|
title = "Domina la configuración de tabi: guía completa"
|
||||||
date = 2023-09-18
|
date = 2023-09-18
|
||||||
updated = 2023-10-05
|
updated = 2023-10-27
|
||||||
description = "Descubre las múltiples maneras en que puedes personalizar tabi."
|
description = "Descubre las múltiples maneras en que puedes personalizar tabi."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -452,6 +452,8 @@ Para activar los comentarios en una página, establece el nombre del sistema com
|
|||||||
|
|
||||||
Si quieres activar los comentarios de forma global, puedes hacerlo estableciendo `enabled_for_all_posts = true` en la sección apropiada de tu `config.toml` (por ejemplo, en `[extra.giscus]`).
|
Si quieres activar los comentarios de forma global, puedes hacerlo estableciendo `enabled_for_all_posts = true` en la sección apropiada de tu `config.toml` (por ejemplo, en `[extra.giscus]`).
|
||||||
|
|
||||||
|
Si has activado un sistema globalmente, pero quieres desactivarlo en una página específica, puedes hacerlo estableciendo el nombre del sistema como `false` en el front matter. Por ejemplo, `utterances = false`.
|
||||||
|
|
||||||
Lee la [documentación](/es/blog/comments/) para obtener más información sobre los sistemas disponibles y su configuración.
|
Lee la [documentación](/es/blog/comments/) para obtener más información sobre los sistemas disponibles y su configuración.
|
||||||
|
|
||||||
### Análisis web
|
### Análisis web
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Mastering tabi Settings: A Comprehensive Guide"
|
title = "Mastering tabi Settings: A Comprehensive Guide"
|
||||||
date = 2023-09-18
|
date = 2023-09-18
|
||||||
updated = 2023-10-05
|
updated = 2023-10-27
|
||||||
description = "Discover the many ways you can customise your tabi site."
|
description = "Discover the many ways you can customise your tabi site."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -456,6 +456,8 @@ To enable comments on an individual page, set the name of the system you want to
|
|||||||
|
|
||||||
To enable a system globally (on all pages), set `enabled_for_all_posts = true` in the correct section of your `config.toml` (e.g. inside `[extra.giscus]`).
|
To enable a system globally (on all pages), set `enabled_for_all_posts = true` in the correct section of your `config.toml` (e.g. inside `[extra.giscus]`).
|
||||||
|
|
||||||
|
If you have enabled a system globally, but want to disable it on a specific page, set the name of the system to `false` in the front matter of that page. For example, `utterances = false`.
|
||||||
|
|
||||||
Read [the docs](/blog/comments/) for more information on the available systems and their setup.
|
Read [the docs](/blog/comments/) for more information on the available systems and their setup.
|
||||||
|
|
||||||
### Analytics
|
### Analytics
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table> #}
|
</table> #}
|
||||||
|
{# {{ __tera_context }} #}
|
||||||
{# End debugging #}
|
{# End debugging #}
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
@ -107,33 +108,21 @@
|
|||||||
{{ page.content | replace(from="<!-- toc -->", to=macros_toc::toc(page=page, header=false, language_strings=language_strings)) | safe }}
|
{{ page.content | replace(from="<!-- toc -->", to=macros_toc::toc(page=page, header=false, language_strings=language_strings)) | safe }}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{# Check if comments are enabled #}
|
{# Check if comments are enabled, checking that they are not disabled on the specific page #}
|
||||||
{% set giscus_enabled = config.extra.giscus.enabled_for_all_posts or page.extra.giscus %}
|
{% set systems = ["giscus", "utterances", "hyvortalk", "isso"] %}
|
||||||
{% set utterances_enabled = config.extra.utterances.enabled_for_all_posts or page.extra.utterances %}
|
|
||||||
{% set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk %}
|
|
||||||
{% set isso_enabled = config.extra.isso.enabled_for_all_posts or page.extra.isso %}
|
|
||||||
|
|
||||||
{# Ensure only one comment system is enabled #}
|
|
||||||
{# Counter for enabled comment systems #}
|
|
||||||
{% set enabled_systems = 0 %}
|
{% set enabled_systems = 0 %}
|
||||||
|
{% set comment_system = "" %}
|
||||||
|
|
||||||
{# Check and count the enabled comment systems #}
|
{% for system in systems %}
|
||||||
{% if giscus_enabled %}
|
{% set global_enabled = config.extra[system].enabled_for_all_posts | default(value=false) %}
|
||||||
{% set comment_system = "giscus" %}
|
{% set page_enabled = page.extra[system] | default(value=global_enabled) %}
|
||||||
{% set enabled_systems = enabled_systems + 1 %}
|
{% set is_enabled = global_enabled and page_enabled != false or page_enabled == true %}
|
||||||
{% endif %}
|
|
||||||
{% if utterances_enabled %}
|
{% if is_enabled %}
|
||||||
{% set comment_system = "utterances" %}
|
{% set_global comment_system = system %}
|
||||||
{% set enabled_systems = enabled_systems + 1 %}
|
{% set_global enabled_systems = enabled_systems + 1 %}
|
||||||
{% endif %}
|
|
||||||
{% if hyvortalk_enabled %}
|
|
||||||
{% set comment_system = "hyvortalk" %}
|
|
||||||
{% set enabled_systems = enabled_systems + 1 %}
|
|
||||||
{% endif %}
|
|
||||||
{% if isso_enabled %}
|
|
||||||
{% set comment_system = "isso" %}
|
|
||||||
{% set enabled_systems = enabled_systems + 1 %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{# Ensure only one comment system is enabled #}
|
{# Ensure only one comment system is enabled #}
|
||||||
{% if enabled_systems > 1 %}
|
{% if enabled_systems > 1 %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user