feat(footer): Add link to remote repository (#111)

main
Óscar 2 years ago committed by GitHub
commit d3167adb8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -111,7 +111,7 @@ The content outside the front matter will be rendered between the header title a
- set the title and taxonomies for each language; - set the title and taxonomies for each language;
- add the `language_name.{code}` in `[extra]`. This is the text shown in the language switcher. - add the `language_name.{code}` in `[extra]`. This is the text shown in the language switcher.
See [these lines in the provided `config.toml`](https://github.com/welpo/tabi/blob/main/config.toml#L22-L132) for an example. See [these lines in the provided `config.toml`](https://github.com/welpo/tabi/blob/main/config.toml#L22-L134) for an example.
You will need an `_index.{language_code}.md` per language for each section (e.g. /blog or /projects) that you want to enable in that language. You will need an `_index.{language_code}.md` per language for each section (e.g. /blog or /projects) that you want to enable in that language.

@ -72,6 +72,7 @@ show_original_quote = "Mostrar cita original"
show_translation = "Mostrar traducción" show_translation = "Mostrar traducción"
load_comments = "Cargar comentarios" load_comments = "Cargar comentarios"
see_changes = "Ver cambios" see_changes = "Ver cambios"
site_source = "Código del sitio"
# Quotation marks for multilingual quote shortcode. # Quotation marks for multilingual quote shortcode.
open_quotation_mark = "«" open_quotation_mark = "«"
close_quotation_mark = "»" close_quotation_mark = "»"
@ -117,6 +118,7 @@ show_original_quote = "Mostra la cita original"
show_translation = "Mostra la traducció" show_translation = "Mostra la traducció"
load_comments = "Carregar comentaris" load_comments = "Carregar comentaris"
see_changes = "Veure canvis" see_changes = "Veure canvis"
site_source = "Codi del lloc"
# Quotation marks for multilingual quote shortcode. # Quotation marks for multilingual quote shortcode.
open_quotation_mark = "«" open_quotation_mark = "«"
close_quotation_mark = "»" close_quotation_mark = "»"
@ -138,15 +140,18 @@ language_name.en = "English"
language_name.es = "Español" language_name.es = "Español"
# Remote repository for your Zola site. # Remote repository for your Zola site.
# Only used to link to the commit history of updated posts, right next to the updated date. # Used for `show_remote_changes` and `show_remote_source` (see below).
# Supports GitHub, GitLab, Gitea, and Codeberg. # Supports GitHub, GitLab, Gitea, and Codeberg.
remote_repository_url = "https://github.com/welpo/tabi" remote_repository_url = "https://github.com/welpo/tabi"
# Set this to "auto" to try and auto-detect the platform based on the repository URL. # Set this to "auto" to try and auto-detect the platform based on the repository URL.
# Accepted values are "github", "gitlab", "gitea", and "codeberg". # Accepted values are "github", "gitlab", "gitea", and "codeberg".
# Defaults to "auto". remote_repository_git_platform = "auto" # Defaults to "auto".
remote_repository_git_platform = "auto" # Branch in the repo hosting the Zola site.
# Branch in the repo hosting the Zola site. Defaults to "main". remote_repository_branch = "main" # Defaults to "main".
remote_repository_branch = "main" # Show a link to the commit history of updated posts, right next to the last updated date.
show_remote_changes = true # Defaults to true.
# Show a link to the repository of the site, right next to the "Powered by Zola & tabi" text.
show_remote_source = true # Defaults to true.
# Enable JavaScript theme toggler to allow users to switch between dark/light mode. # Enable JavaScript theme toggler to allow users to switch between dark/light mode.
# Also enables automatic switching based on user's OS-level theme settings. # Also enables automatic switching based on user's OS-level theme settings.

@ -32,7 +32,9 @@
{% if page.updated %} {% if page.updated %}
</ul><ul class="meta last-updated"><li>{%- if lang != config.default_language %} {{ trans(key="last_updated_on" | safe, lang=lang) }} {% else %} Last updated on {% endif %} {{ macros_format_date::format_date(date=page.updated, short=true) }}</li> </ul><ul class="meta last-updated"><li>{%- if lang != config.default_language %} {{ trans(key="last_updated_on" | safe, lang=lang) }} {% else %} Last updated on {% endif %} {{ macros_format_date::format_date(date=page.updated, short=true) }}</li>
{% if config.extra.remote_repository_url %} {# Show link to remote changes if enabled #}
{% set show_remote_changes = config.extra.show_remote_changes | default(value=true) %}
{% if config.extra.remote_repository_url and show_remote_changes %}
<li>&nbsp;{{ separator }}&nbsp;<a href="{{ macros_create_history_url::create_history_url(relative_path=page.relative_path) }}" target="_blank" rel="noopener noreferrer">{%- if lang != config.default_language -%}{{ trans(key="see_changes" | safe, lang=lang) }}{% else %}See changes{%- endif -%}<small></small></a></li> <li>&nbsp;{{ separator }}&nbsp;<a href="{{ macros_create_history_url::create_history_url(relative_path=page.relative_path) }}" target="_blank" rel="noopener noreferrer">{%- if lang != config.default_language -%}{{ trans(key="see_changes" | safe, lang=lang) }}{% else %}See changes{%- endif -%}<small></small></a></li>
{% endif %} {% endif %}
{% endif %} {% endif %}

@ -1,3 +1,4 @@
{% set separator = config.extra.separator | default(value="•") %}
<footer> <footer>
<section> <section>
<nav class="socials nav-navs"> <nav class="socials nav-navs">
@ -49,7 +50,35 @@
{% endif %} {% endif %}
</nav> </nav>
<div class="credits"> <div class="credits">
<small>{%- if lang != config.default_language %} {{ trans(key="powered_by" | safe, lang=lang) }} {% else %} Powered by {% endif %} <a href="https://www.getzola.org" target="_blank">Zola</a> {%- if lang != config.default_language %} {{ trans(key="and" | safe, lang=lang) }} {% else %} & {% endif %} <a href="https://github.com/welpo/tabi" target="_blank">tabi</a></small> {# Shows "Powered by Zola & tabi" #}
{# Shows link to remote repository if repository is set and `show_remote_source` is not false #}
{% set show_source = config.extra.show_remote_source | default(value=true) %}
<small>
{%- if lang != config.default_language -%}
{{ trans(key="powered_by" | safe, lang=lang) }}
{%- else -%}
Powered by
{%- endif -%}
&nbsp;<a href="https://www.getzola.org" target="_blank">Zola</a>&nbsp;
{%- if lang != config.default_language -%}
{{ trans(key="and" | safe, lang=lang) }}
{%- else -%}
&
{%- endif -%}
&nbsp;<a href="https://github.com/welpo/tabi" target="_blank">tabi</a>
{%- if config.extra.remote_repository_url and show_source -%}
&nbsp;{{ separator }}
<a href="{{ config.extra.remote_repository_url }}" target="_blank">
{%- if lang != config.default_language -%}
{{ trans(key="site_source" | safe, lang=lang) }}
{%- else -%}
Site source
{%- endif -%}
</a>
{%- endif -%}
</small>
</div> </div>
</section> </section>

Loading…
Cancel
Save