The big shortcode cleanup
This commit is contained in:
@ -10,9 +10,9 @@
|
||||
{%- endif -%}
|
||||
|
||||
{%- if page.extra.comments.user -%}
|
||||
{%- set username = page.extra.comments.user -%}
|
||||
{%- set user = page.extra.comments.user -%}
|
||||
{%- else %}
|
||||
{%- set username = config.extra.comments.user -%}
|
||||
{%- set user = config.extra.comments.user -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- set id = page.extra.comments.id -%}
|
||||
@ -28,7 +28,7 @@
|
||||
decoding="async"
|
||||
loading="lazy"
|
||||
{%- endif -%}
|
||||
src="https://api.qrserver.com/v1/create-qr-code/?data=https://{{ host }}/@{{ username }}/{{ id }}"
|
||||
src="https://api.qrserver.com/v1/create-qr-code/?data=https://{{ host }}/@{{ user }}/{{ id }}"
|
||||
/>
|
||||
{%- endif -%}
|
||||
<h2>{{ macros_translate::translate(key="comments", default="Comments", language_strings=language_strings) }}</h2>
|
||||
@ -37,7 +37,7 @@
|
||||
<button id="load-comments" class="inline-button" onclick="loadComments()">
|
||||
{{- macros_translate::translate(key="load_comments", default="Load Comments", language_strings=language_strings) -}}
|
||||
</button>
|
||||
<a class="inline-button colored external" href="https://{{ host }}/@{{ username }}/{{ id }}" rel="{{ rel_attributes }}">
|
||||
<a class="inline-button colored external" href="https://{{ host }}/@{{ user }}/{{ id }}" rel="{{ rel_attributes }}">
|
||||
{{- macros_translate::translate(key="open_post", default="Open Post", language_strings=language_strings) -}}
|
||||
</a>
|
||||
</div>
|
||||
@ -129,7 +129,7 @@
|
||||
const isReply = status.in_reply_to_id !== "{{ id }}";
|
||||
|
||||
let op = false;
|
||||
if (status.account.acct == "{{ username }}") {
|
||||
if (status.account.acct == "{{ user }}") {
|
||||
op = true;
|
||||
}
|
||||
|
||||
|
@ -4,50 +4,50 @@
|
||||
content="default-src 'self'
|
||||
{%- if config.extra.csp -%}
|
||||
|
||||
{#- Initialise a base script-src directive -#}
|
||||
{%- set script_src = "script-src 'self'" -%}
|
||||
{#- Initialise a base script-src directive -#}
|
||||
{%- set script_src = "script-src 'self'" -%}
|
||||
|
||||
{#- Initialise a base connect-src directive -#}
|
||||
{%- set connect_src = "connect-src 'self'" -%}
|
||||
{#- Initialise a base connect-src directive -#}
|
||||
{%- set connect_src = "connect-src 'self'" -%}
|
||||
|
||||
{# Base logic for appending analytics domains #}
|
||||
{%- if config.extra.goatcounter %}
|
||||
{%- set goatcounter_host = config.extra.goatcounter.host | default(value='goatcounter.com') -%}
|
||||
{%- set goatcounter_url = "https://" ~ config.extra.goatcounter.user ~ "." ~ goatcounter_host ~ "/count" %}
|
||||
{%- set script_src = script_src ~ " " ~ goatcounter_url -%}
|
||||
{%- set connect_src = connect_src ~ " " ~ goatcounter_url -%}
|
||||
{%- endif %}
|
||||
{# Base logic for appending analytics domains #}
|
||||
{%- if config.extra.goatcounter %}
|
||||
{%- set goatcounter_host = config.extra.goatcounter.host | default(value='goatcounter.com') -%}
|
||||
{%- set goatcounter_url = "https://" ~ config.extra.goatcounter.user ~ "." ~ goatcounter_host ~ "/count" %}
|
||||
{%- set script_src = script_src ~ " " ~ goatcounter_url -%}
|
||||
{%- set connect_src = connect_src ~ " " ~ goatcounter_url -%}
|
||||
{%- endif %}
|
||||
|
||||
{#- Append WebSocket for Zola serve mode -#}
|
||||
{%- if config.mode == "serve" -%}
|
||||
{%- set connect_src = connect_src ~ " ws:" -%}
|
||||
{%- endif -%}
|
||||
{#- Append WebSocket for Zola serve mode -#}
|
||||
{%- if config.mode == "serve" -%}
|
||||
{%- set connect_src = connect_src ~ " ws:" -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- for domain in config.extra.csp -%}
|
||||
{%- if domain.directive == "connect-src" -%}
|
||||
{%- set configured_connect_src = domain.domains | join(sep=' ') -%}
|
||||
{%- set_global connect_src = connect_src ~ " " ~ configured_connect_src -%}
|
||||
{%- continue -%}
|
||||
{%- endif -%}
|
||||
{%- for domain in config.extra.csp -%}
|
||||
{%- if domain.directive == "connect-src" -%}
|
||||
{%- set configured_connect_src = domain.domains | join(sep=' ') -%}
|
||||
{%- set_global connect_src = connect_src ~ " " ~ configured_connect_src -%}
|
||||
{%- continue -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if domain.directive == "script-src" -%}
|
||||
{%- set configured_script_src = domain.domains | join(sep=' ') -%}
|
||||
{%- set_global script_src = script_src ~ " " ~ configured_script_src -%}
|
||||
{%- continue -%}
|
||||
{%- endif -%}
|
||||
{%- if domain.directive == "script-src" -%}
|
||||
{%- set configured_script_src = domain.domains | join(sep=' ') -%}
|
||||
{%- set_global script_src = script_src ~ " " ~ configured_script_src -%}
|
||||
{%- continue -%}
|
||||
{%- endif -%}
|
||||
|
||||
{#- Handle directives that are not connect-src -#}
|
||||
{{ domain.directive }} {{ domain.domains | join(sep=' ') -}}
|
||||
{#- Handle directives that are not connect-src -#}
|
||||
{{ domain.directive }} {{ domain.domains | join(sep=' ') -}}
|
||||
|
||||
{%- if not loop.last -%}
|
||||
;
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- if not loop.last -%}
|
||||
;
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{#- Insert the generated connect-src -#}
|
||||
{{ ";" ~ connect_src }}
|
||||
{#- Insert the generated connect-src -#}
|
||||
{{ ";" ~ connect_src }}
|
||||
|
||||
{#- Insert the generated script-src -#}
|
||||
{{ ";" ~ script_src }}
|
||||
{#- Insert the generated script-src -#}
|
||||
{{ ";" ~ script_src }}
|
||||
|
||||
{%- endif -%}">
|
||||
|
@ -1,7 +1,7 @@
|
||||
{%- if page.extra.default_theme -%}
|
||||
data-theme="{{ page.extra.default_theme }}"
|
||||
data-theme="{{ page.extra.default_theme }}"
|
||||
{%- elif section.extra.default_theme -%}
|
||||
data-theme="{{ section.extra.default_theme }}"
|
||||
data-theme="{{ section.extra.default_theme }}"
|
||||
{%- elif config.extra.default_theme -%}
|
||||
data-theme="{{ config.extra.default_theme }}"
|
||||
data-theme="{{ config.extra.default_theme }}"
|
||||
{%- endif -%}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{%- if page.description -%}
|
||||
{{- page.description }}
|
||||
{{- page.description }}
|
||||
{%- elif section.description -%}
|
||||
{{- section.description }}
|
||||
{{- section.description }}
|
||||
{%- else -%}
|
||||
{{- config.description -}}
|
||||
{{- config.description -}}
|
||||
{%- endif -%}
|
||||
|
@ -4,25 +4,25 @@
|
||||
{%- elif section.extra.favicon -%}
|
||||
{{ get_url(path=section.colocated_path ~ section.extra.favicon) }}
|
||||
{%- else -%}
|
||||
{{ get_url(path='favicon.png') }}
|
||||
{{ get_url(path='favicon.png') }}
|
||||
{%- endif -%}" />
|
||||
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="
|
||||
{%- if page.extra.apple_touch_icon -%}
|
||||
{{ get_url(path=page.colocated_path ~ page.extra.apple_touch_icon) }}
|
||||
{%- elif section.extra.apple_touch_icon -%}
|
||||
{{ get_url(path=section.colocated_path ~ section.extra.apple_touch_icon) }}
|
||||
{{ get_url(path=section.colocated_path ~ section.extra.apple_touch_icon) }}
|
||||
{%- else -%}
|
||||
{{ get_url(path='apple-touch-icon.png') }}
|
||||
{{ get_url(path='apple-touch-icon.png') }}
|
||||
{%- endif -%}" />
|
||||
|
||||
{%- if page.extra.emoji_favicon or section.extra.emoji_favicon or config.extra.emoji_favicon %}
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext x='-.07em' y='.89em' font-size='90'%3E
|
||||
{%- if page.extra.emoji_favicon -%}
|
||||
{{ page.extra.emoji_favicon | truncate(length=1, end='') }}
|
||||
{%- elif section.extra.emoji_favicon -%}
|
||||
{{ section.extra.emoji_favicon | truncate(length=1, end='') }}
|
||||
{%- else -%}
|
||||
{{ config.extra.emoji_favicon | truncate(length=1, end='') }}
|
||||
{%- endif -%}%3C/text%3E%3C/svg%3E">
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext x='-.07em' y='.89em' font-size='90'%3E
|
||||
{%- if page.extra.emoji_favicon -%}
|
||||
{{ page.extra.emoji_favicon | truncate(length=1, end='') }}
|
||||
{%- elif section.extra.emoji_favicon -%}
|
||||
{{ section.extra.emoji_favicon | truncate(length=1, end='') }}
|
||||
{%- else -%}
|
||||
{{ config.extra.emoji_favicon | truncate(length=1, end='') }}
|
||||
{%- endif -%}%3C/text%3E%3C/svg%3E">
|
||||
{%- endif %}
|
||||
|
@ -1,42 +1,42 @@
|
||||
{#- Based on https://github.com/welpo/tabi/blob/7b00ed1d9dca5c529d2816c5b6679bfe600d63fc/templates/partials/language_switcher.html -#}
|
||||
|
||||
<li id="language-switcher">
|
||||
<details class="closable">
|
||||
<summary class="circle" title="{{ macros_translate::translate(key='language', default='Language', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</summary>
|
||||
<ul>
|
||||
{%- for lcode, ldetails in config.languages -%}
|
||||
{#- Skip the current language to avoid linking to the current page -#}
|
||||
{%- if lang == lcode -%}
|
||||
{%- continue -%}
|
||||
{%- endif -%}
|
||||
{#- Dynamically load the language strings for each language -#}
|
||||
{%- set other_language_strings = load_data(path="i18n/" ~ lcode ~ ".toml", required=false) -%}
|
||||
{%- if not other_language_strings -%}
|
||||
{%- set other_language_strings = load_data(path="themes/duckquill/i18n/" ~ lcode ~ ".toml", required=false) -%}
|
||||
{%- endif -%}
|
||||
{#- Use the loaded language strings to get the language name -#}
|
||||
{% set language_name = macros_translate::translate(key="language_name", default=lcode, language_strings=other_language_strings) %}
|
||||
{#- Check if the language code matches the default language -#}
|
||||
{%- if lcode == config.default_language -%}
|
||||
{#- If it does, link to the root path (no language code in URL) -#}
|
||||
<li>
|
||||
<a lang="{{ lcode }}" href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/') }}">{{ language_name }}</a>
|
||||
</li>
|
||||
{#- Check if the current language is the default language -#}
|
||||
{#- If it is, append the language code to the base URL -#}
|
||||
{%- elif lang == config.default_language -%}
|
||||
<li>
|
||||
<a lang="{{ lcode }}" href="{{ config.base_url }}/{{ lcode }}{{ current_path | default(value="/") | safe }}">{{ language_name }}</a>
|
||||
</li>
|
||||
{%- else -%}
|
||||
{#- If it's not, replace the current language code in the URL with the new one -#}
|
||||
<li>
|
||||
<a lang="{{ lcode }}" href="{{ current_url | replace(from='/' ~ lang ~ '/', to='/' ~ lcode ~ '/') }}">{{ language_name }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</details>
|
||||
<details class="closable">
|
||||
<summary class="circle" title="{{ macros_translate::translate(key='language', default='Language', language_strings=language_strings) }}">
|
||||
<i class="icon"></i>
|
||||
</summary>
|
||||
<ul>
|
||||
{%- for lcode, ldetails in config.languages -%}
|
||||
{#- Skip the current language to avoid linking to the current page -#}
|
||||
{%- if lang == lcode -%}
|
||||
{%- continue -%}
|
||||
{%- endif -%}
|
||||
{#- Dynamically load the language strings for each language -#}
|
||||
{%- set other_language_strings = load_data(path="i18n/" ~ lcode ~ ".toml", required=false) -%}
|
||||
{%- if not other_language_strings -%}
|
||||
{%- set other_language_strings = load_data(path="themes/duckquill/i18n/" ~ lcode ~ ".toml", required=false) -%}
|
||||
{%- endif -%}
|
||||
{#- Use the loaded language strings to get the language name -#}
|
||||
{% set language_name = macros_translate::translate(key="language_name", default=lcode, language_strings=other_language_strings) %}
|
||||
{#- Check if the language code matches the default language -#}
|
||||
{%- if lcode == config.default_language -%}
|
||||
{#- If it does, link to the root path (no language code in URL) -#}
|
||||
<li>
|
||||
<a lang="{{ lcode }}" href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/') }}">{{ language_name }}</a>
|
||||
</li>
|
||||
{#- Check if the current language is the default language -#}
|
||||
{#- If it is, append the language code to the base URL -#}
|
||||
{%- elif lang == config.default_language -%}
|
||||
<li>
|
||||
<a lang="{{ lcode }}" href="{{ config.base_url }}/{{ lcode }}{{ current_path | default(value="/") | safe }}">{{ language_name }}</a>
|
||||
</li>
|
||||
{%- else -%}
|
||||
{#- If it's not, replace the current language code in the URL with the new one -#}
|
||||
<li>
|
||||
<a lang="{{ lcode }}" href="{{ current_url | replace(from='/' ~ lang ~ '/', to='/' ~ lcode ~ '/') }}">{{ language_name }}</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{%- if page.title -%}
|
||||
{{- page.title }} - {{ config.title -}}
|
||||
{{- page.title }} - {{ config.title -}}
|
||||
{%- elif section.title -%}
|
||||
{{- section.title }} - {{ config.title -}}
|
||||
{{- section.title }} - {{ config.title -}}
|
||||
{%- else -%}
|
||||
{{- config.title -}}
|
||||
{{- config.title -}}
|
||||
{%- endif -%}
|
||||
|
Reference in New Issue
Block a user