feat(copyright): add support for $TITLE variable

In copyright, `$TITLE` is replaced by the website's title.
This commit is contained in:
ZzMzaw 2023-10-26 22:50:37 +02:00
parent 1c6834a44e
commit a1889a00cf
6 changed files with 16 additions and 14 deletions

View file

@ -188,10 +188,11 @@ footer_menu = [
]
# Enable a copyright notice for the footer, shown between socials and the "Powered by" text.
# $TITLE will be replaced by the website's title.
# You can use $CURRENT_YEAR to automatically insert the current year.
# $SEPARATOR will be replaced by the `separator` variable.
# Markdown is supported (links, emphasis, etc).
# copyright = "© $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
# copyright = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
# For multi-language sites, you can set a different copyright for each language.
# If this is set to true, ensure you have a translation in `copyright_translations` for each language.
@ -199,7 +200,7 @@ translate_copyright = false
# If `translate_copyright` is set to true, `copyright_translations` can be empty but must exist.
# A build time error will be raised otherwise in order to make sure people already using previous translation method (i18n files) won't forgot to move translations back in config.toml.
# If a translation is missing for language, the `copyright` value will be used instead.
# copyright_translations.es = "© $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
# copyright_translations.es = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
# Custom security headers. What urls should your website be able to connect to?
# You need to specify the CSP and the URLs associated with the directive.

View file

@ -544,10 +544,10 @@ footer_menu = [
Per afegir una menció sobre els drets d'autor al teu lloc web, configura `copyright`:
```toml
copyright = "© $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
copyright = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
```
`$CURRENT_YEAR` es substituirà per l'any actual i `$SEPARATOR` es substituirà per la [variable `separator`](#separador-personalitzat). El text es processarà en Markdown. Per exemple:
`$TITLE` es substituirà per el títol (variable `config.title`), `$CURRENT_YEAR` es substituirà per l'any actual i `$SEPARATOR` es substituirà per la [variable `separator`](#separador-personalitzat). El text es processarà en Markdown. Per exemple:
{{ dual_theme_image(light_src="blog/mastering-tabi-settings/img/copyright_light.webp", dark_src="blog/mastering-tabi-settings/img/copyright_dark.webp" alt="Secció de drets d'autor", full_width=true) }}
@ -557,7 +557,7 @@ Si tens un lloc multilingüe i vols establir diferents notificacions de drets d'
2. Afegeix una traducció a `copyright_translations` per a l'idioma esperat (que coincideix amb la variable `lang`) de la manera següent:
```toml
copyright_translations.es = "© $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
copyright_translations.es = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
```
---

View file

@ -542,10 +542,10 @@ footer_menu = [
Para añadir una mención sobre los derechos de autor a tu sitio web, configura `copyright`:
```toml
copyright = "© $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
copyright = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
```
`$CURRENT_YEAR` se reemplazará por el año actual y `$SEPARATOR` se reemplazará por la [variable `separator`](#separador-personalizado). Se procesará el texto en Markdown. Por ejemplo:
`$TITLE` se reemplazará por el título (variable `config.title`), `$CURRENT_YEAR` se reemplazará por el año actual y `$SEPARATOR` se reemplazará por la [variable `separator`](#separador-personalizado). Se procesará el texto en Markdown. Por ejemplo:
{{ dual_theme_image(light_src="blog/mastering-tabi-settings/img/copyright_light.webp", dark_src="blog/mastering-tabi-settings/img/copyright_dark.webp" alt="Sección de derechos de autor", full_width=true) }}
@ -555,7 +555,7 @@ Si tienes un sitio multilingüe y deseas establecer diferentes notificaciones de
2. Añade una traducción en `copyright_translations` para el idioma esperado (que coincida con la variable `lang`) de la siguiente manera:
```toml
copyright_translations.es = "© $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
copyright_translations.es = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
```
---

View file

@ -546,10 +546,10 @@ footer_menu = [
To add a copyright notice to your site, set `copyright`:
```toml
copyright = "© $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
copyright = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
```
`$CURRENT_YEAR` will be replaced by the current year, and `$SEPARATOR` will be replaced by the [`separator` variable](#custom-separator). Markdown is rendered. The example above:
`$TITLE` will be replaced by the title (`config.title` variable), `$CURRENT_YEAR` will be replaced by the current year, and `$SEPARATOR` will be replaced by the [`separator` variable](#custom-separator). Markdown is rendered. The example above:
{{ dual_theme_image(light_src="blog/mastering-tabi-settings/img/copyright_light.webp", dark_src="blog/mastering-tabi-settings/img/copyright_dark.webp" alt="Copyright section", full_width=true) }}
@ -559,7 +559,7 @@ If you have a multilingual site and want to set different copyright notices for
2. Add a translation to `copyright_translations` for the expected language (matching the `lang` variable) as follow:
```toml
copyright_translations.es = "© $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
copyright_translations.es = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
```
---

View file

@ -96,7 +96,7 @@
{% set copyright = config.extra.copyright_translations[lang] %}
{%- endif -%}
{%- endif -%}
<p>{{ copyright | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SEPARATOR", to=separator) | markdown | safe }}</p>
<p>{{ copyright | replace(from="$TITLE", to=config.title) | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SEPARATOR", to=separator) | markdown | safe }}</p>
{%- endif -%}
{# Shows "Powered by Zola & tabi" notice #}

View file

@ -167,10 +167,11 @@ encode_plaintext_email = true # Setting is ignored if email is already encoded.
# ]
# Enable a copyright notice for the footer, shown between socials and the "Powered by" text.
# $TITLE will be replaced by the website's title.
# You can use $CURRENT_YEAR to automatically insert the current year.
# $SEPARATOR will be replaced by the `separator` variable.
# Markdown is supported (links, emphasis, etc).
# copyright = "© $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
# copyright = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR Unless otherwise noted, the content in this website is available under the [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) license."
# For multi-language sites, you can set a different copyright for each language.
# If this is set to true, ensure you have a translation in `copyright_translations` for each language.
@ -178,7 +179,7 @@ translate_copyright = false
# If `translate_copyright` is set to true, `copyright_translations` can be empty but must exist.
# A build time error will be raised otherwise in order to make sure people already using previous translation method (i18n files) won't forgot to move translations back in config.toml.
# If a translation is missing for language, the `copyright` value will be used instead.
# copyright_translations.es = "© $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
# copyright_translations.es = "$TITLE © $CURRENT_YEAR Your Name $SEPARATOR A menos que se indique lo contrario, el contenido de este sitio web está disponible bajo la licencia [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)."
# Custom security headers. What urls should your website be able to connect to?
# You need to specify the CSP and the URLs associated with the directive.