✨ feat(footer): add link to remote repository
Adds two options, both defaulting to true if the remote repo URL is set: * `show_remote_changes`: links the commit history of a post next to the updated date. (#109) * `show_remote_source`: links to the site's repository on the footer.
This commit is contained in:
parent
6dc6e51ea8
commit
99f6f2dcdc
@ -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;
|
||||
- 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.
|
||||
|
||||
|
15
config.toml
15
config.toml
@ -72,6 +72,7 @@ show_original_quote = "Mostrar cita original"
|
||||
show_translation = "Mostrar traducción"
|
||||
load_comments = "Cargar comentarios"
|
||||
see_changes = "Ver cambios"
|
||||
site_source = "Código del sitio"
|
||||
# Quotation marks for multilingual quote shortcode.
|
||||
open_quotation_mark = "«"
|
||||
close_quotation_mark = "»"
|
||||
@ -117,6 +118,7 @@ show_original_quote = "Mostra la cita original"
|
||||
show_translation = "Mostra la traducció"
|
||||
load_comments = "Carregar comentaris"
|
||||
see_changes = "Veure canvis"
|
||||
site_source = "Codi del lloc"
|
||||
# Quotation marks for multilingual quote shortcode.
|
||||
open_quotation_mark = "«"
|
||||
close_quotation_mark = "»"
|
||||
@ -138,15 +140,18 @@ language_name.en = "English"
|
||||
language_name.es = "Español"
|
||||
|
||||
# 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.
|
||||
remote_repository_url = "https://github.com/welpo/tabi"
|
||||
# Set this to "auto" to try and auto-detect the platform based on the repository URL.
|
||||
# Accepted values are "github", "gitlab", "gitea", and "codeberg".
|
||||
# Defaults to "auto".
|
||||
remote_repository_git_platform = "auto"
|
||||
# Branch in the repo hosting the Zola site. Defaults to "main".
|
||||
remote_repository_branch = "main"
|
||||
remote_repository_git_platform = "auto" # Defaults to "auto".
|
||||
# Branch in the repo hosting the Zola site.
|
||||
remote_repository_branch = "main" # Defaults to "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.
|
||||
# Also enables automatic switching based on user's OS-level theme settings.
|
||||
|
@ -32,7 +32,9 @@
|
||||
|
||||
{% 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>
|
||||
{% 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> {{ separator }} <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 %}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{% set separator = config.extra.separator | default(value="•") %}
|
||||
<footer>
|
||||
<section>
|
||||
<nav class="socials nav-navs">
|
||||
@ -49,7 +50,35 @@
|
||||
{% endif %}
|
||||
</nav>
|
||||
<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 -%}
|
||||
<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>
|
||||
|
||||
{%- if config.extra.remote_repository_url and show_source -%}
|
||||
{{ 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>
|
||||
</section>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user