diff options
| author | Jieiku | 2026-08-14 15:10:15 -0700 |
|---|---|---|
| committer | Jieiku | 2026-08-14 15:10:15 -0700 |
| commit | c2d72e09747a2a4abe9602e1ba49a1b4649c9d3c (patch) | |
| tree | 51a272ef184752e27bb70c07e4726dbdbbe6e237 /templates | |
| parent | d52609f456f233ec0845c8a57a1e27583f0813ad (diff) | |
| download | abridge-c2d72e09747a2a4abe9602e1ba49a1b4649c9d3c.tar.gz abridge-c2d72e09747a2a4abe9602e1ba49a1b4649c9d3c.tar.bz2 abridge-c2d72e09747a2a4abe9602e1ba49a1b4649c9d3c.zip | |
Update for Zola 0.23.3
Diffstat (limited to 'templates')
31 files changed, 759 insertions, 828 deletions
diff --git a/templates/404.html b/templates/404.html index 8c42866..70e1f91 100644 --- a/templates/404.html +++ b/templates/404.html @@ -2,20 +2,17 @@ {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} -{%- block seo %} +{%- block seo -%} {{ super() }} - {%- set title = "404 Page not found" %} - - {%- if config.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_404=true) }} -{%- endblock seo %} + {%- set title = "404 Page not found" -%} + {%- if config.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_404={true} />}} +{%- endblock seo -%} {%- block content %} <div> @@ -29,11 +26,11 @@ {%- set i18n_404 = load_data(path="i18n/" ~ lcode ~ '.toml', required=false) -%} {%- if not i18n_404 -%}{%- set i18n_404 = load_data(path="themes/abridge/i18n/" ~ lcode ~ ".toml", required=false) -%}{%- endif %} - <p>{{ macros::translate(key="404_not_found", default="404_not_found", i18n=i18n_404) }}{{ macros::translate(key="full_stop", default=".", i18n=i18n_404) }} {% if config.build_search_index %}{{ macros::translate(key="404_try_search", default="Try searching or", i18n=i18n_404) }}{% endif %} <a href="{{ config.base_url }}/{{ lcode }}/{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="404_go_home", default="go to homepage", i18n=i18n_404) }}</a>{{ macros::translate(key="full_stop", default=".", i18n=i18n_404) }}</p> + <p>{{<translate key="404_not_found" default="404_not_found" i18n={i18n_404} />}}{{<translate key="full_stop" default="." i18n={i18n_404} />}} {% if config.build_search_index %}{{<translate key="404_try_search" default="Try searching or" i18n={i18n_404} />}}{% endif %} <a href="{{ config.base_url }}/{{ lcode }}/{%- if uglyurls %}index.html{%- endif %}">{{<translate key="404_go_home" default="go to homepage" i18n={i18n_404} />}}</a>{{<translate key="full_stop" default="." i18n={i18n_404} />}}</p> {%- endif -%} {%- endfor -%} {% if config.default_language != "en" %} - <p>{{ macros::translate(key="404_not_found", default="404_not_found", i18n=i18n) }}{{ macros::translate(key="full_stop", default=".", i18n=i18n) }} {% if config.build_search_index %}{{ macros::translate(key="404_try_search", default="Try searching or", i18n=i18n) }}{% endif %} <a href="{{ config.base_url }}/{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="404_go_home", default="go to homepage", i18n=i18n) }}</a>{{ macros::translate(key="full_stop", default=".", i18n=i18n) }}</p> + <p>{{<translate key="404_not_found" default="404_not_found" i18n={i18n} />}}{{<translate key="full_stop" default="." i18n={i18n} />}} {% if config.build_search_index %}{{<translate key="404_try_search" default="Try searching or" i18n={i18n} />}}{% endif %} <a href="{{ config.base_url }}/{%- if uglyurls %}index.html{%- endif %}">{{<translate key="404_go_home" default="go to homepage" i18n={i18n} />}}</a>{{<translate key="full_stop" default="." i18n={i18n} />}}</p> {% endif %} </div> {%- endblock content %} diff --git a/templates/archive.html b/templates/archive.html index aac705a..8bc0f27 100644 --- a/templates/archive.html +++ b/templates/archive.html @@ -7,24 +7,21 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} -{%- block seo %} - {{- super() }} - {%- set title = "Archive" %} - - {%- if config.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} -{%- endblock seo %} +{%- block seo -%} + {{- super() -}} + {%- set title = "Archive" -%} + {%- if config.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_home={true} />}} +{%- endblock seo -%} {%- block content %} {#- The following line is checking if the template is being used for the archive page or a section #} - {%- if current_path is matching("^(/[[:alpha:]][[:alpha:]])?/archive/$") %} + {%- if current_path is matching(pat="^(/[[:alpha:]][[:alpha:]])?/archive/$") %} {%- if section.extra.sec %} {%- set sec = section.extra.sec ~ "/" %} {%- else %} @@ -36,7 +33,7 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- set langpath = "/" ~ lang ~ "/" %} {%- endif %} - {%- set sec = current_path | trim_start_matches(pat=langpath) | split(pat="/page/") | slice(end=1) | join(sep="") | trim_end_matches(pat="/") %} + {%- set sec = current_path | trim_start(pat=langpath) | split(pat="/page/") | first | trim_end(pat="/") %} {%- set sec = sec ~ "/" %} {%- endif %} diff --git a/templates/base.html b/templates/base.html index d16854c..97d2f4d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,29 +1,22 @@ -{%- import 'macros/seo.html' as macros_seo %} -{%- import "macros/macros.html" as macros %} -{# Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. #} +{#- Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. -#} {%- set i18n = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%} -{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif %} - +{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif -%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} +{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} <!DOCTYPE html> <html lang="{%- if lang != config.default_language %}{{ lang }}{% else %}{{ config.extra.language_code | default(value=lang) }}{% endif %}"> <head> - {%- include "partials/head.html" %} - - {#- SEO: title, description, etc #} - {%- block seo %} - {%- if config.extra.title_separator %} + {%- include "partials/head.html" -%} + {#- SEO: title, description, etc -#} + {%- block seo -%} + {%- if config.extra.title_separator -%} {%- set title_separator = " " ~ config.extra.title_separator ~ " " -%} - {%- else %} + {%- else -%} {%- set title_separator = " | " -%} - {%- endif %} - {%- endblock seo %} - - {%- block comments_init %} - {%- endblock comments_init %} - - {%- include "partials/head_js.html" %} + {%- endif -%} + {%- endblock seo -%} + {%- block comments_init -%}{%- endblock comments_init -%} + {%- include "partials/head_js.html" -%} </head> <body> {%- block header %} @@ -33,10 +26,10 @@ {%- if config.extra.logo -%} <big><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}" title="{{config.title}}"> - {%- if config.extra.logo.file -%} - <img src="{{ config.base_url | safe }}/{{ config.extra.logo.file | safe }}"{%- if config.extra.logo.alt %} alt="{{ config.extra.logo.alt | safe }}"{%- else %} alt=""{%- endif %}{%- if config.extra.logo.width %} width="{{ config.extra.logo.width | safe }}"{%- endif %}{%- if config.extra.logo.height %} height="{{ config.extra.logo.height | safe }}"{%- endif %} /> + {%- if config.extra.logo?.file -%} + <img src="{{ config.base_url | safe }}/{{ config.extra.logo?.file | safe }}"{%- if config.extra.logo?.alt %} alt="{{ config.extra.logo?.alt | safe }}"{%- else %} alt=""{%- endif %}{%- if config.extra.logo?.width %} width="{{ config.extra.logo?.width | safe }}"{%- endif %}{%- if config.extra.logo?.height %} height="{{ config.extra.logo?.height | safe }}"{%- endif %} /> {%- endif -%} - {%- if config.extra.logo.text -%}{{ config.extra.logo.text | safe }}{%- endif -%} + {%- if config.extra.logo?.text -%}{{ config.extra.logo?.text | safe }}{%- endif -%} </a></big> {%- elif config.extra.textlogo -%} @@ -55,8 +48,8 @@ {%- set js_switcher=config.extra.js_switcher | default(value=true) %} {%- if config.extra.menu %} {%- for i in config.extra.menu -%} - <li><a{%- if i.size %} class="{{ i.size }}"{% endif %} href="{%- if i.url is matching("^http[s]?://") %}{{ i.url }}{%- else -%}{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> - {%- if lang != config.default_language %} {{ macros::translate(key=i.name|safe, default=i.name|safe, i18n=i18n) }} {% else %} {{ i.name | safe }} {% endif -%} + <li><a{%- if i.size %} class="{{ i.size }}"{% endif %} href="{%- if i.url is matching(pat="^http[s]?://") %}{{ i.url }}{%- else -%}{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> + {%- if lang != config.default_language %} {{<translate key={i.name | safe} default={i.name | safe} i18n={i18n} />}} {% else %} {{ i.name | safe }} {% endif -%} </a></li> {%- endfor -%} {%- endif -%} @@ -65,17 +58,17 @@ <li><div class="dropdown"><i class="svgs world" type="reset"></i> {%- if current_url %} <div class="dropdown-content"> - <span>{{ macros::translate(key="language_name", default="lang_name", i18n=i18n) }}</span> + <span>{{<translate key="language_name" default="lang_name" i18n={i18n} />}}</span> {%- for lcode,language in config.languages -%} {%- set i18n_menu = load_data(path="i18n/" ~ lcode ~ '.toml', required=false) -%} {%- if not i18n_menu -%}{%- set i18n_menu = load_data(path="themes/abridge/i18n/" ~ lcode ~ ".toml", required=false) -%}{%- endif %} {%- if lang != lcode -%} {%- if lcode == config.default_language -%} - <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="language_name", default="language_name", i18n=i18n_menu) }}</a> + <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{<translate key="language_name" default="language_name" i18n={i18n_menu} />}}</a> {%- elif lang == config.default_language -%} - <a href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="language_name", default="language_name", i18n=i18n_menu) }}</a> + <a href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{<translate key="language_name" default="language_name" i18n={i18n_menu} />}}</a> {%- else -%} - <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/' ~ lcode ~ '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ macros::translate(key="language_name", default="language_name", i18n=i18n_menu) }}</a> + <a href="{{ current_url | replace(from='/' ~ lang ~ '/', to = '/' ~ lcode ~ '/') | safe }}{%- if uglyurls %}index.html{%- endif %}">{{<translate key="language_name" default="language_name" i18n={i18n_menu} />}}</a> {%- endif -%} {%- endif -%} {%- endfor -%} @@ -98,7 +91,7 @@ <div> <form autocomplete=off class="js" name="goSearch" id="searchbox"> <div class="searchd"> - <input id="searchinput" type="text" placeholder="{{ macros::translate(key="Search", default="Search", i18n=i18n) }}" title="Search" /> + <input id="searchinput" type="text" placeholder="{{<translate key="Search" default="Search" i18n={i18n} />}}" title="Search" /> <button type="submit" title="Search" class="{%- if icon_search -%}{{ icon_search }}{%- else -%}si{%- endif -%}">{%- if not icon_search -%}⌕{%- endif -%}</button> </div> <div class="results"><div id="suggestions"></div></div> @@ -136,14 +129,14 @@ {%- if config.extra.menu_footer %} <nav class="vpad"> {%- for i in config.extra.menu_footer -%} - {%- if i.url is matching("^http[s]?://") %} + {%- if i.url is matching(pat="^http[s]?://") %} {%- set furl=i.url %} {%- elif i.url != "sitemap.xml" %} {%- set furl=get_url(path=i.url, lang=lang, trailing_slash=i.slash) %} {%- else %} {%- set furl=get_url(path=i.url, trailing_slash=i.slash) %} {%- endif %} - <a class="rpad{%- if i.size %} {{ i.size }}{% endif %}" href="{{ furl | safe }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{ macros::translate(key=i.name|safe, default=i.name|safe, i18n=i18n) }} {% else %} {{ i.name | safe }} {% endif %}</a> + <a class="rpad{%- if i.size %} {{ i.size }}{% endif %}" href="{{ furl | safe }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{<translate key={i.name | safe} default={i.name | safe} i18n={i18n} />}} {% else %} {{ i.name | safe }} {% endif %}</a> {%- endfor %} </nav> {%- endif %} @@ -155,7 +148,8 @@ {%- if config.extra.copyright_override -%} {%- if lang != config.default_language %} - {%- set copyright_string = macros::translate(key='copyright_override', default='© $CURRENT_YEAR $SITE_TITLE', i18n=i18n) | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %} + {%- set copyright_string %}{{<translate key="copyright_override" default="© $CURRENT_YEAR $SITE_TITLE" i18n={i18n} />}}{% endset -%} + {%- set copyright_string = copyright_string | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %} {% else %} {%- set copyright_string = config.extra.copyright_override | replace(from="$CURRENT_YEAR", to=current_year) | replace(from="$SITE_TITLE", to=config.title) %} {% endif -%} @@ -170,7 +164,7 @@ {%- if config.extra.footer_credit_override %} {{ config.extra.footer_credit_override | safe }} {%- else %} - <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}>{{ macros::translate(key="Powered_by", default="Powered by", i18n=i18n) }} <a href="https://www.getzola.org/" target="_blank">Zola</a> {{ macros::translate(key="and", default="and", i18n=i18n) }} <a href="https://github.com/jieiku/abridge/" target="_blank">Abridge</a></p> + <p{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %}>{{<translate key="Powered_by" default="Powered by" i18n={i18n} />}} <a href="https://www.getzola.org/" target="_blank">Zola</a> {{<translate key="and" default="and" i18n={i18n} />}} <a href="https://github.com/jieiku/abridge/" target="_blank">Abridge</a></p> {%- endif %} {%- endif %} </div> diff --git a/templates/categories/list.html b/templates/categories/list.html index 4566a75..966fd03 100644 --- a/templates/categories/list.html +++ b/templates/categories/list.html @@ -1,26 +1,21 @@ -{% extends "base.html" %} +{%- extends "base.html" -%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - -{%- block seo %} - {{- super() }} - {%- set title = "Categories" %} - - {%- if config.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} -{%- endblock seo %} - +{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} +{%- block seo -%} + {{- super() -}} + {%- set title = "Categories" -%} + {%- if config.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_home={true} />}} +{%- endblock seo -%} {%- block content %} <div> <div class="c"> - <h1>{{ terms | length }} {{ macros::translate(key="Categories", default="Categories", i18n=i18n) }} </h1> + <h1>{{ terms | length }} {{<translate key="Categories" default="Categories" i18n={i18n} />}} </h1> <p>{% for term in terms %} [<a href="#{{ term.name }}">{{ term.name }}</a>]<sup>{{ term.pages | length }}</sup> {% endfor %}</p> </div> {%- for term in terms %} diff --git a/templates/categories/single.html b/templates/categories/single.html index 08b4327..de68a4f 100644 --- a/templates/categories/single.html +++ b/templates/categories/single.html @@ -1,22 +1,17 @@ -{% extends "base.html" %} +{%- extends "base.html" -%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - -{%- block seo %} - {{- super() }} - {%- set title = term.name ~ " category" %} - - {%- if config.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} -{%- endblock seo %} - +{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} +{%- block seo -%} + {{- super() -}} + {%- set title = term.name ~ " category" -%} + {%- if config.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_home={true} />}} +{%- endblock seo -%} {%- block content %} <div> <h2>{{ term.name }}</h2> diff --git a/templates/components/audio.html b/templates/components/audio.html new file mode 100644 index 0000000..f31488d --- /dev/null +++ b/templates/components/audio.html @@ -0,0 +1,30 @@ +{% component audio(page, config, sources, caption="", class="", autoplay=false, loop=false, muted=false, playsinline=false) %} +{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} +<audio controls{% if class %} class="{{class}}"{% endif %}{% if autoplay %} autoplay{% endif %}{% if loop %} loop{% endif %}{% if muted %} muted{% endif %}{% if playsinline %} playsinline{% endif %}> + {% for src in sources %} + + {%- set file = src | split(pat="/") | last %} + {%- set dirtest = src | trim_start(pat="./") %} + {%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} + {%- if page and page.path %}{%- set pagepath = page.path %}{%- elif section and section.path %}{%- set pagepath = section.path %}{%- endif %} + + {%- if src is starting_with(pat="./") and reldir %}{# Relative Path #} + {%- set path = (src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} + {%- set path = path ~ "/" %} + + {%- elif src is starting_with(pat="/") %}{# Root Path #} + {%- set rootpath = (src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} + + {%- else %}{# Same Directory Path #} + {%- set path = "" %} + + {%- endif %} + + {%- set type = src | split(pat=".") | last %} + {%- if type is matching(pat="^mov$") %}{% set type = "quicktime" %}{% endif %} + <source src="{{ path | safe }}{{ file | safe }}" type="{{ 'audio/' ~ type }}" /> + {%- endfor -%}Your browser doesn't support the audio tag and/or the audio formats in use here – sorry!</audio> +{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif %} + +{% endcomponent audio %} diff --git a/templates/macros/macros.html b/templates/components/components.html index 84ad119..7ce9ef3 100644 --- a/templates/macros/macros.html +++ b/templates/components/components.html @@ -1,180 +1,172 @@ -{%- macro translate(key, i18n="", default="") %} +{# Former macro components #} + +{% component translate(key: string, i18n, default="") %} {{- i18n[key] | default(value=default) | safe -}} -{%- endmacro %} +{% endcomponent translate %} -{%- macro page_listing(page, config) %} +{%- component page_listing(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} +{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set uglyurls = true %}{%- endif %}{%- endif %} <div class="tpad"> <a href="{{ page.permalink | safe}}{%- if uglyurls %}index.html{%- endif %}">{{ page.title | markdown(inline=true) | safe }}</a> </div> -{%- endmacro page_listing %} - +{%- endcomponent page_listing %} -{%- macro series_link(inner, page, config) %} +{%- component series_link(inner, page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} +{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set uglyurls = true %}{%- endif %}{%- endif %} {%- if inner.content == page.content %} - <a class="scur" href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> - {% else %} - <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> + <a class="scur" href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> + {%- else %} + <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> {%- endif %} -{%- endmacro %} - +{%- endcomponent series_link %} -{%- macro title_post(page, config) %} -{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} +{%- component title_post(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) %} +{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set uglyurls = true %}{%- endif %}{%- endif %} <h1><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title | markdown(inline=true) | safe }}</a></h1> -{%- endmacro title_post %} - - +{%- endcomponent title_post %} -{%- macro meta_post(page, config) %} -{# Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. #} -{%- set i18n = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%} -{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif %} +{%- component meta_post(page, config) -%} +{#- Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. -#} +{%- set i18n = load_data(path="i18n/" ~ page.lang ~ '.toml', required=false) -%} +{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ page.lang ~ ".toml", required=false) -%}{%- endif -%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - <span{%- if config.extra.meta_post.size %} class="{{ config.extra.meta_post.size }}"{% endif %}> +{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set uglyurls = true -%}{%- endif %}{%- endif %} + <span{%- if config.extra.meta_post?.size %} class="{{ config.extra.meta_post?.size }}"{% endif %}> {#- Author #} {%- if page.taxonomies.authors and config.taxonomies %} {%- for author in page.taxonomies.authors %} {%- if author_flag %}, {% endif %} - <a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ author }}</a> + <a href="{{ get_taxonomy_url(kind='authors', term=author) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ author }}</a> {%- set_global author_flag = true %} {%- endfor %} - {%- elif page.extra.authors and config.extra.meta_post.author %} + {%- elif page.extra.authors and config.extra.meta_post?.author %} {%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {%- for author in page.extra.authors %} {%- if author_flag %}, {% endif %} {{ author }} {%- set_global author_flag = true %} {%- endfor %} - {%- elif config.extra.author and config.extra.meta_post.author %} + {%- elif config.extra.author and config.extra.meta_post?.author %} {%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {{ config.extra.author }} {%- endif %} {#- divider #} - {%- if config.extra.meta_post.author %} - {%- if config.extra.meta_post.readtime or config.extra.meta_post.date or config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %} + {%- if config.extra.meta_post?.author %} + {%- if config.extra.meta_post?.readtime or config.extra.meta_post?.date or config.extra.meta_post?.updated or config.extra.meta_post?.categories_tags %} + {%- if config.extra.meta_post?.divider %}<span class="hpad">{{ config.extra.meta_post?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %} {%- endif %} {%- endif %} {#- ReadTime #} - {%- if config.extra.meta_post.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_post.readstring | default(value="min") }} + {%- if config.extra.meta_post?.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_post?.readstring | default(value="min") }} {#- divider #} - {%- if config.extra.meta_post.date or config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{%- endif %} + {%- if config.extra.meta_post?.date or config.extra.meta_post?.updated or config.extra.meta_post?.categories_tags %} + {%- if config.extra.meta_post?.divider %}<span class="hpad">{{ config.extra.meta_post?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{%- endif %} {#- Date #} - {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} - {%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%} - {%- set page_date = page.date | date(format="%B %d, %Y", locale=lang_locale) -%} + {%- if config.extra.meta_post?.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} + {%- set lang_locale %}{{<translate key='date_locale' default='en_US' i18n={i18n} />}}{% endset %} + {%- set page_date = page.date | date(format="%B %d, %Y", locale=lang_locale) %} {%- if page_date %} {{ page_date }} {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} - {%- if config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_post?.updated or config.extra.meta_post?.categories_tags %} + {%- if config.extra.meta_post?.divider %}<span class="hpad">{{ config.extra.meta_post?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Updated #} - {%- if config.extra.meta_post.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%} - {{ macros::translate(key="Updated", default="Updated", i18n=i18n) }}: - {%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%} - {%- set page_updated = page.updated | date(format="%B %d, %Y", locale=lang_locale) -%} + {%- if config.extra.meta_post?.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} + {{<translate key="Updated" default="Updated" i18n={i18n} />}}: + {%- set lang_locale %}{{<translate key='date_locale' default='en_US' i18n={i18n} />}}{% endset %} + {%- set page_updated = page.updated | date(format="%B %d, %Y", locale=lang_locale) %} {%- if page_updated %} {{ page_updated }} {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} - {%- if config.extra.meta_post.categories_tags %} - {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_post?.categories_tags %} + {%- if config.extra.meta_post?.divider %}<span class="hpad">{{ config.extra.meta_post?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Categories #} - {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{%- if not loop.last %}, {% endif %}{% endfor %}]{% endif %} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', term=cat, lang=page.lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{%- if not loop.last %}, {% endif %}{% endfor %}]{% endif %} {#- Tags #} - {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> -{%- endmacro meta_post %} - - + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', term=tag, lang=page.lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor %}{%- endif %}</span> +{%- endcomponent meta_post %} -{%- macro title_index(page, config) %} -{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} +{%- component title_index(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} <big>{% if config.extra.title_size_index %}<span class="{{ config.extra.title_size_index }}">{% endif %}<a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title | markdown(inline=true) | safe }}</a>{% if config.extra.title_size_index %}</span>{% endif %}</big> -{%- endmacro title_index %} - +{%- endcomponent title_index -%} - -{%- macro meta_index(page, config) %} -{# Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. #} -{%- set i18n = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%} -{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif %} -{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - <span{%- if config.extra.meta_index.size %} class="{{ config.extra.meta_index.size }}"{% endif %}> +{%- component meta_index(page, config) %} +{#- Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. -#} +{%- set i18n = load_data(path="i18n/" ~ page.lang ~ '.toml', required=false) -%} +{%- if not i18n %}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ page.lang ~ ".toml", required=false) %}{%- endif %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} + <span{%- if config.extra.meta_index?.size %} class="{{ config.extra.meta_index?.size }}"{% endif %}> {#- Author #} {%- if page.taxonomies.authors and config.taxonomies %} {%- for author in page.taxonomies.authors %} {%- if author_flag %}, {% endif %} - <a href="{{ get_taxonomy_url(kind='authors', name=author, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ author }}</a> + <a href="{{ get_taxonomy_url(kind='authors', term=author, lang=page.lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ author }}</a> {%- set_global author_flag = true %} {%- endfor %} - {%- elif page.extra.authors and config.extra.meta_index.author %} + {%- elif page.extra.authors and config.extra.meta_index?.author %} {%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {%- for author in page.extra.authors %} {%- if author_flag %}, {% endif %} {{ author }} {%- set_global author_flag = true %} {%- endfor %} - {%- elif config.extra.author and config.extra.meta_index.author %} + {%- elif config.extra.author and config.extra.meta_index?.author %} {%- if config.extra.icon_author %}<i class="{{ config.extra.icon_author }}"></i> {% endif %} {{ config.extra.author }} {%- endif %} {#- divider #} - {%- if config.extra.meta_index.author %} - {%- if config.extra.meta_index.readtime or config.extra.meta_index.date or config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %} + {%- if config.extra.meta_index?.author %} + {%- if config.extra.meta_index?.readtime or config.extra.meta_index?.date or config.extra.meta_index?.updated or config.extra.meta_index?.categories_tags %} + {%- if config.extra.meta_index?.divider %}<span class="hpad">{{ config.extra.meta_index?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %} {%- endif %} {%- endif %} {#- ReadTime #} - {%- if config.extra.meta_index.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_index.readstring | default(value="min") }} + {%- if config.extra.meta_index?.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_index?.readstring | default(value="min") }} {#- divider #} - {%- if config.extra.meta_index.date or config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{%- endif %} + {%- if config.extra.meta_index?.date or config.extra.meta_index?.updated or config.extra.meta_index?.categories_tags %} + {%- if config.extra.meta_index?.divider %}<span class="hpad">{{ config.extra.meta_index?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{%- endif %} {#- Date #} - {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} - {%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%} - {%- set page_date = page.date | date(format="%B %d, %Y", locale=lang_locale) -%} + {%- if config.extra.meta_index?.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} + {%- set lang_locale %}{{<translate key='date_locale' default='en_US' i18n={i18n} />}}{% endset %} + {%- set page_date = page.date | date(format="%B %d, %Y", locale=lang_locale) %} {%- if page_date %} {{ page_date }} {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} - {%- if config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_index?.updated or config.extra.meta_index?.categories_tags %} + {%- if config.extra.meta_index?.divider %}<span class="hpad">{{ config.extra.meta_index?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Updated #} - {%- if config.extra.meta_index.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%} - {{ macros::translate(key="Updated", default="Updated", i18n=i18n) }}: - {%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%} - {%- set page_updated = page.updated | date(format="%B %d, %Y", locale=lang_locale) -%} + {%- if config.extra.meta_index?.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} + {{<translate key="Updated" default="Updated" i18n={i18n} />}}: + {%- set lang_locale %}{{<translate key='date_locale' default='en_US' i18n={i18n} />}}{% endset %} + {%- set page_updated = page.updated | date(format="%B %d, %Y", locale=lang_locale) %} {%- if page_updated %} {{ page_updated }} {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} - {%- if config.extra.meta_index.categories_tags %} - {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} + {%- if config.extra.meta_index?.categories_tags %} + {%- if config.extra.meta_index?.divider %}<span class="hpad">{{ config.extra.meta_index?.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %} {#- Categories #} - {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{%- if not loop.last %}, {% endif %}{% endfor %}]{% endif %} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', term=cat, lang=page.lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{%- if not loop.last %}, {% endif %}{% endfor %}]{% endif %} {#- Tags #} - {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> -{%- endmacro meta_index %} + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', term=tag, lang=page.lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor %}{%- endif %}</span> +{%- endcomponent meta_index -%} - - -{%- macro footer(page, config) %} +{%- component footer(page, config) %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - {#- prev/next content page nextprev title pagination #} +{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set uglyurls = true %}{%- endif %}{%- endif %} + {#- prev/next content page nextprev title pagination -#} {%- if not config.extra.hide_page_nextprev_titles | default(value=false) %} {%- if page.lower or page.higher %} <nav> @@ -191,12 +183,10 @@ </nav> {%- endif %} {%- endif %} -{%- endmacro footer %} +{%- endcomponent footer %} - - -{%- macro pagination(paginator, config)%} -{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{% component pagination(paginator, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) %} {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} {%- if paginator.number_pagers > 1 %} {%- if paginator.number_pagers <= 5 %} {# 5 or less pager is simple, just display all 5 #} @@ -227,83 +217,81 @@ {%- endif %} {%- endif %} <nav class="vpad"> - {%- set icon_first=config.extra.icon_first | default(value="svgs svgh angll") -%} - {%- set icon_prev=config.extra.icon_prev | default(value="svgs svgh angl") -%} - {%- set icon_next=config.extra.icon_next | default(value="svgs svgh angr") -%} - {%- set icon_last=config.extra.icon_last | default(value="svgs svgh angrr") -%} - {%- if paginator.previous -%} + {%- set icon_first=config.extra.icon_first | default(value="svgs svgh angll") %} + {%- set icon_prev=config.extra.icon_prev | default(value="svgs svgh angl") %} + {%- set icon_next=config.extra.icon_next | default(value="svgs svgh angr") %} + {%- set icon_last=config.extra.icon_last | default(value="svgs svgh angrr") %} + {%- if paginator.previous %} <a class="on outp" href="{{ paginator.first | safe }}{%- if uglyurls %}index.html{%- endif %}" title="First Page"> - {%- if icon_first -%}<i class="{{ icon_first }}" alt="First Page"></i> - {%- else -%}« - {%- endif -%} + {%- if icon_first %}<i class="{{ icon_first }}" alt="First Page"></i> + {%- else %}« + {%- endif %} </a> - {%- else -%} + {%- else %} <span class="off outp"> - {%- if icon_first -%}<i class="{{ icon_first }}" alt="First Page"></i> - {%- else -%}« - {%- endif -%} + {%- if icon_first %}<i class="{{ icon_first }}" alt="First Page"></i> + {%- else %}« + {%- endif %} </span> - {%- endif -%} + {%- endif %} - {%- if paginator.previous -%} + {%- if paginator.previous %} <a class="on outp" href="{{ paginator.previous | safe }}{%- if uglyurls %}index.html{%- endif %}" title="Previous Page"> - {%- if icon_prev -%}<i class="{{ icon_prev }}" alt="Previous Page"></i> - {%- else -%}‹ - {%- endif -%} + {%- if icon_prev %}<i class="{{ icon_prev }}" alt="Previous Page"></i> + {%- else %}‹ + {%- endif %} </a> - {%- else -%} + {%- else %} <span class="off outp"> - {%- if icon_prev -%}<i class="{{ icon_prev }}" alt="Previous Page"></i> - {%- else -%}‹ - {%- endif -%} + {%- if icon_prev %}<i class="{{ icon_prev }}" alt="Previous Page"></i> + {%- else %}‹ + {%- endif %} </span> - {%- endif -%} + {%- endif %} - {%- for i in range(start=start, end=end+1) -%} - {%- if i == paginator.current_index -%} + {%- for i in range(start=start, end=end+1) %} + {%- if i == paginator.current_index %} <a class="inp on cnav" href="#">{{i}}</a> - {%- elif i > 1 -%} + {%- elif i > 1 %} <a class="inp on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if uglyurls %}index.html{%- endif %}">{{i}}</a> - {%- else -%} + {%- else %} <a class="inp on" href="{{ paginator.first | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ i }}</a> - {%- endif -%} - {%- endfor -%} + {%- endif %} + {%- endfor %} - {%- if paginator.next -%} + {%- if paginator.next %} <a class="on outp" href="{{ paginator.next | safe }}{%- if uglyurls %}index.html{%- endif %}" title="Next Page"> - {%- if icon_next -%}<i class="{{ icon_next }}" alt="Next Page"></i> - {%- else -%}› - {%- endif -%} + {%- if icon_next %}<i class="{{ icon_next }}" alt="Next Page"></i> + {%- else %}› + {%- endif %} </a> - {%- else -%} + {%- else %} <span class="off outp"> - {%- if icon_next -%}<i class="{{ icon_next }}" alt="Next Page"></i> - {%- else -%}› - {%- endif -%} + {%- if icon_next %}<i class="{{ icon_next }}" alt="Next Page"></i> + {%- else %}› + {%- endif %} </span> - {%- endif -%} + {%- endif %} - {%- if paginator.next -%} + {%- if paginator.next %} <a class="on outp" href="{{ paginator.last | safe }}{%- if uglyurls %}index.html{%- endif %}" title="Last Page"> - {%- if icon_last -%}<i class="{{ icon_last }}" alt="Last Page"></i> - {%- else -%}» - {%- endif -%} + {%- if icon_last %}<i class="{{ icon_last }}" alt="Last Page"></i> + {%- else %}» + {%- endif %} </a> - {%- else -%} + {%- else %} <span class="off outp"> - {%- if icon_last -%}<i class="{{ icon_last }}" alt="Last Page"></i> - {%- else -%}» - {%- endif -%} + {%- if icon_last %}<i class="{{ icon_last }}" alt="Last Page"></i> + {%- else %}» + {%- endif %} </span> - {%- endif -%} + {%- endif %} </nav> {%- endif %} -{%- endmacro %} +{% endcomponent pagination %} - - -{%- macro numpagination(paginator, config)%} -{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{% component numpagination(paginator, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) %} {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} {%- if paginator.number_pagers > 1 %} {%- if paginator.number_pagers <= 5 %} {# 5 or less pager is simple, just display all 5 #} @@ -345,19 +333,19 @@ {%- elif paginator.current_index > 4 and paginator.number_pagers > 6 %} <a class="inp on" href="{{ paginator.first | safe }}{%- if uglyurls %}index.html{%- endif %}" aria-label="First Page">1</a> <a class="inp on" href="{{ paginator.base_url | safe }}{{ 2 ~ '/' }}{%- if uglyurls %}index.html{%- endif %}" aria-label="Page 2">2</a> - {%- elif paginator.current_index > 3 and paginator.number_pagers > 5 -%} + {%- elif paginator.current_index > 3 and paginator.number_pagers > 5 %} <a class="inp on" href="{{ paginator.first | safe }}{%- if uglyurls %}index.html{%- endif %}" aria-label="First Page">1</a> - {%- endif -%} + {%- endif %} - {%- for i in range(start=start, end=end+1) -%} - {%- if i == paginator.current_index -%} + {%- for i in range(start=start, end=end+1) %} + {%- if i == paginator.current_index %} <a class="inp on cnav" href="#">{{i}}</a> - {%- elif i > 1 -%} + {%- elif i > 1 %} <a class="inp on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if uglyurls %}index.html{%- endif %}" aria-label="Page {{i}}">{{i}}</a> - {%- else -%} + {%- else %} <a class="inp on" href="{{ paginator.first | safe }}{%- if uglyurls %}index.html{%- endif %}" aria-label="Page {{i}}">{{ i }}</a> - {%- endif -%} - {%- endfor -%} + {%- endif %} + {%- endfor %} {%- if paginator.number_pagers > paginator.current_index+5 and paginator.number_pagers > 7 %} <span class="dis outp">...</span> @@ -372,7 +360,145 @@ <a class="inp on" href="{{ paginator.last | safe }}{%- if uglyurls %}index.html{%- endif %}" aria-label="Last Page">{{paginator.number_pagers}}</a> {%- elif paginator.number_pagers > paginator.current_index+2 and paginator.number_pagers > 5 %} <a class="inp on" href="{{ paginator.last | safe }}{%- if uglyurls %}index.html{%- endif %}" aria-label="Last Page">{{paginator.number_pagers}}</a> - {%- endif -%} + {%- endif %} </nav> {%- endif %} -{%- endmacro %} +{% endcomponent numpagination %} + +{% component seo( config, title="", title_addition="", description="", type="website", is_home=false, is_404=false, is_page=false, page_images="", page_section="", created_time="2023-05-15T07:07:00-07:00", updated_time="2023-05-15T07:07:00-07:00", page="" ) -%} +{#- Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. -#} +{%- set _lang = page.lang if page else config.default_language -%} +{%- set i18n = load_data(path="i18n/" ~ _lang ~ '.toml', required=false) -%} +{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ _lang ~ ".toml", required=false) -%}{%- endif -%} +{%- set lang_locale %}{{<translate key='date_locale' default='en_US' i18n={i18n} />}}{% endset -%} +{%- if is_404 %} + <meta name="robots" content="noindex, follow" /> +{%- else %} + <meta name="robots" content="index, follow" /> + <meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> + <meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> +{%- endif %} + +{%- if current_url %} + {%- set page_url = current_url %} +{%- else %} + {%- set page_url = get_url(path="404.html", trailing_slash=true) %} +{%- endif %} + <title>{{ title ~ title_addition }}</title> + +{%- if config.extra?.author %} + <meta name="author" content="{{ config.extra?.author }}" /> +{%- endif %} +{%- if config.extra?.facebook_publisher %} + <meta property="article:publisher" content="https://www.facebook.com/{{ config.extra?.facebook_publisher }}" /> +{%- endif %} + <meta name="copyright" content="{{ config.title }}" /> +{%- if config.extra?.facebook_author %} + <meta property="article:author" content="https://www.facebook.com/{{ config.extra?.facebook_author }}" /> +{%- endif %} +{%- if page?.description %} + <meta name="description" content="{{ page?.description }}" /> +{%- else %} + <meta name="description" content="{{ config.description }}" /> +{%- endif %} + <link rel="canonical" href="{{ page_url | safe }}" /> +{%- if page?.extra?.keywords and config.extra?.keywords %} + <meta name="keywords" content="{{ page?.extra?.keywords }}, {{ config.extra?.keywords }}" /> +{%- elif page?.extra?.keywords %} + <meta name="keywords" content="{{ page?.extra?.keywords }}" /> +{%- elif config.extra?.keywords %} + <meta name="keywords" content="{{ config.extra?.keywords }}" /> +{%- endif %} + +{#- Extra SEO START #} +{%- if config.extra?.seo | default(value=true) %} +{%- if not is_404 %} + +{%- if config.extra?.google %} + <meta name="google-site-verification" content="{{ config.extra?.google | safe }}" /> +{%- endif %} + +{%- if config.extra?.bing %} + <meta name="msvalidate.01" content="{{ config.extra?.bing | safe}}" /> +{%- endif %} + <meta property="og:url" content="{{ page_url | safe }}" /> + <meta name="twitter:url" content="{{ page_url | safe }}" /> + +{%- if page?.description %} + <meta property="og:description" content="{{ page?.description }}" /> + <meta name="twitter:description" content="{{ page?.description }}" /> +{%- else %} + <meta property="og:description" content="{{ config.description }}" /> + <meta name="twitter:description" content="{{ config.description}}" /> +{%- endif %} + +{%- if page?.title %} + <meta property="og:title" content="{{ page?.title }} | {{ config.title }}" /> + <meta name="twitter:title" content="{{ page?.title }} | {{ config.title }}" /> +{%- else %} + <meta property="og:title" content="{{ config.title }}" /> + <meta name="twitter:title" content="{{ config.title }}" /> +{%- endif %} + + +{#- SEO MEDIA START #} +{%- if page?.extra?.thumbnail %} + <meta name="twitter:card" content="summary_large_image" /> + <meta name="twitter:image" content="{{ get_url(path=page?.path ~ page?.extra?.thumbnail, trailing_slash=false) }}" /> + <meta property="og:image" content="{{ get_url(path=page?.path ~ page?.extra?.thumbnail, trailing_slash=false) }}" /> + +{%- elif page?.extra?.static_thumbnail %} + <meta name="twitter:card" content="summary_large_image" /> + {%- if page?.extra?.static_thumbnail is matching(pat="^http[s]?://") %} + <meta name="twitter:image" content="{{ page?.extra?.static_thumbnail }}" /> + <meta property="og:image" content="{{ page?.extra?.static_thumbnail }}" /> + {%- else %} + <meta name="twitter:image" content="{{ get_url(path=page?.extra?.static_thumbnail, trailing_slash=false) }}" /> + <meta property="og:image" content="{{ get_url(path=page?.extra?.static_thumbnail, trailing_slash=false) }}" /> + {%- endif %} + +{%- elif config.extra?.banner %} + <meta name="twitter:card" content="summary_large_image" /> + <meta name="twitter:image" content="{{ get_url(path=config.extra?.banner, trailing_slash=false) }}" /> + <meta property="og:image" content="{{ get_url(path=config.extra?.banner, trailing_slash=false) }}" /> + +{%- else %} + <meta name="twitter:card" content="summary" /> + +{%- endif %} + +{%- if config.extra?.open?.audio %} + <meta property="og:audio" content="{{ config.extra?.open?.audio }}" /> +{%- endif %} + +{%- if config.extra?.open?.locale %} + <meta property="og:locale" content="{{ config.extra?.open?.locale }}" /> +{%- endif %} + +{%- if config.extra?.open?.videos %} + {%- for video in config.extra?.open?.videos %} + <meta property="og:video" content="{{ get_url(path=video) }}" /> + {%- endfor %} +{%- endif %} + +{#- SEO MEDIA END #} + <meta property="og:site_name" content="{{ config.title }}" /> + <meta property="og:locale" content="{{ lang_locale }}" /> + <meta property="og:type" content="website" /> +{%- if page?.updated %} + <meta property="og:updated_time" content="{{ page?.updated | date(format='%F') }}" /> +{%- elif page?.date %} + <meta property="og:updated_time" content="{{ page?.date | date(format='%F') }}" /> +{%- else %} + <meta property="og:updated_time" content="{{ updated_time }}" /> +{%- endif %} + +{%- if config.extra?.twitter_meta %} + <meta name="twitter:site" content="@{{ config.extra?.twitter_meta }}" /> + <meta name="twitter:creator" content="@{{ config.extra?.twitter_meta }}" /> +{%- endif -%} +{%- endif -%} +{%- endif -%} +{#- Extra SEO END -#} +{% endcomponent seo %} + diff --git a/templates/components/gif.html b/templates/components/gif.html new file mode 100644 index 0000000..cf4d264 --- /dev/null +++ b/templates/components/gif.html @@ -0,0 +1,30 @@ +{% component gif(page, config, sources, caption="", class="", w=0, h=0) %} +{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} +<video controls{% if class %} class="{{class}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} autoplay loop muted playsinline> + {% for src in sources %} + + {%- set video = src | split(pat="/") | last %} + {%- set dirtest = src | trim_start(pat="./") %} + {%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} + {%- if page and page.path %}{%- set pagepath = page.path %}{%- elif section and section.path %}{%- set pagepath = section.path %}{%- endif %} + + {%- if src is starting_with(pat="./") and reldir %}{# Relative Path #} + {%- set path = (src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} + {%- set path = path ~ "/" %} + + {%- elif src is starting_with(pat="/") %}{# Root Path #} + {%- set rootpath = (src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} + + {%- else %}{# Same Directory Path #} + {%- set path = "" %} + + {%- endif %} + + {%- set type = src | split(pat=".") | last %} + {%- if type is matching(pat="^mov$") %}{% set type = "quicktime" %}{% endif %} + <source src="{{ path | safe }}{{ video | safe }}" type="{{ 'video/' ~ type }}" /> + {%- endfor -%}Your browser doesn't support the video tag and/or the video formats in use here – sorry!</video> +{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif %} + +{% endcomponent gif %} diff --git a/templates/shortcodes/image.html b/templates/components/image.html index 22b8f2d..c8230e1 100644 --- a/templates/shortcodes/image.html +++ b/templates/components/image.html @@ -1,18 +1,19 @@ -{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} +{% component image(page, config, sources, caption="", class="", alt="", w=0, h=0) %} +{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} <picture{% if class %} class="{{class}}"{% endif %}> {%- for src in sources %} {%- set video = src | split(pat="/") | last %} - {%- set dirtest = src | trim_start_matches(pat="./") %} - {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} - {%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} + {%- set dirtest = src | trim_start(pat="./") %} + {%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} + {%- if page and page.path %}{%- set pagepath = page.path %}{%- elif section and section.path %}{%- set pagepath = section.path %}{%- endif %} - {%- if src is starting_with("./") and reldir %}{# Relative Path #} - {%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} + {%- if src is starting_with(pat="./") and reldir %}{# Relative Path #} + {%- set path = (src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} {%- set path = path ~ "/" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ path ~ video | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ path ~ video) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ path ~ video %} {%- endif %} @@ -21,9 +22,9 @@ {%- set h = meta.height %} {%- endif %} - {%- elif src is starting_with("/") %}{# Root Path #} - {%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} + {%- elif src is starting_with(pat="/") %}{# Root Path #} + {%- set rootpath = (src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} {%- if not w or not h %} {%- set metapath = rootpath ~ "/" ~ video %} {%- set meta = get_image_metadata(path=metapath) %} @@ -34,8 +35,8 @@ {%- else %}{# Same Directory Path #} {%- set path = "" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ video | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ video) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ video %} {%- endif %} @@ -46,8 +47,8 @@ {%- endif %} - {%- set type = src | split(pat=".") | last -%} - {%- if type is matching("^mov$") %}{%- set type = "quicktime" -%}{% endif -%} + {%- set type = src | split(pat=".") | last %} + {%- if type is matching(pat="^mov$") %}{%- set type = "quicktime" %}{% endif %} {%- if loop.last %} {%- if not alt %} {%- set alt = video | split(pat=".") | first %} @@ -58,4 +59,6 @@ {%- endif %} {%- endfor %} </picture> -{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif -%} +{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif %} + +{% endcomponent image %} diff --git a/templates/shortcodes/img.html b/templates/components/img.html index ed84aa5..6aa5b2e 100644 --- a/templates/shortcodes/img.html +++ b/templates/components/img.html @@ -1,14 +1,15 @@ +{% component img(page, config, src, caption="", class="", alt="", w=0, h=0, link="") %} {%- set img = src | split(pat="/") | last %} -{%- set dirtest = src | trim_start_matches(pat="./") %} -{%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} -{%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} +{%- set dirtest = src | trim_start(pat="./") %} +{%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} +{%- if page and page.path %}{%- set pagepath = page.path %}{%- elif section and section.path %}{%- set pagepath = section.path %}{%- endif %} -{%- if src is starting_with("./") and reldir %} {# Relative Path #} - {%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} +{%- if src is starting_with(pat="./") and reldir %} {# Relative Path #} + {%- set path = (src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} {%- set path = path ~ "/" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ path ~ img) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ path ~ img %} {%- endif %} @@ -17,9 +18,9 @@ {%- set h = meta.height %} {%- endif %} -{%- elif src is starting_with("/") %} {# Root Path #} - {%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} +{%- elif src is starting_with(pat="/") %} {# Root Path #} + {%- set rootpath = (src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} {%- if not w or not h %} {%- set metapath = rootpath ~ "/" ~ img %} {%- set meta = get_image_metadata(path=metapath) %} @@ -30,8 +31,8 @@ {%- else %} {# Same Directory Path #} {%- set path = "" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ img) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ img %} {%- endif %} @@ -44,6 +45,8 @@ {%- if not alt %} {%- set alt = img | split(pat=".") | first %} {%- endif %} -{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} -{%- if link %}<a href="{{link | safe}}">{% endif %}<img src="{{ path | safe }}{{ img | safe }}"{% if class %} class="{{class}}"{% endif %}{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" />{% if link %}</a>{% endif -%} +{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} +{%- if link %}<a href="{{link | safe}}">{% endif %}<img src="{{ path | safe }}{{ img | safe }}"{% if class %} class="{{class}}"{% endif %}{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" />{% if link %}</a>{% endif %} {%- if caption %}<figcaption>{{ caption | safe }}</figcaption></figure>{%- endif %} + +{% endcomponent img %} diff --git a/templates/shortcodes/imgswap.html b/templates/components/imgswap.html index a6f7b83..b260615 100644 --- a/templates/shortcodes/imgswap.html +++ b/templates/components/imgswap.html @@ -1,15 +1,16 @@ +{% component imgswap(page, config, main_src, swap_src, caption="", class="", alt="", w=0, h=0) %} <div class="img-swap-div"> {%- set img = main_src | split(pat="/") | last %} - {%- set dirtest = main_src | trim_start_matches(pat="./") %} - {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} - {%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} + {%- set dirtest = main_src | trim_start(pat="./") %} + {%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} + {%- if page and page.path %}{%- set pagepath = page.path %}{%- elif section and section.path %}{%- set pagepath = section.path %}{%- endif %} - {%- if main_src is starting_with("./") and reldir %} {# Relative Path #} - {%- set path = main_src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} + {%- if main_src is starting_with(pat="./") and reldir %} {# Relative Path #} + {%- set path = (main_src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} {%- set path = path ~ "/" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ path ~ img) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ path ~ img %} {%- endif %} @@ -18,9 +19,9 @@ {%- set h = meta.height %} {%- endif %} - {%- elif main_src is starting_with("/") %} {# Root Path #} - {%- set rootpath = main_src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} + {%- elif main_src is starting_with(pat="/") %} {# Root Path #} + {%- set rootpath = (main_src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} {%- if not w or not h %} {%- set metapath = rootpath ~ "/" ~ img %} {%- set meta = get_image_metadata(path=metapath) %} @@ -31,8 +32,8 @@ {%- else %} {# Same Directory Path #} {%- set path = "" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ img) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ img %} {%- endif %} @@ -45,20 +46,20 @@ {%- if not alt %} {%- set alt = img | split(pat=".") | first %} {%- endif %} - {%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} - {%- if link %}<a href="{{link | safe}}">{% endif %}<img src="{{ path | safe }}{{ img | safe }}" class="img-main{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" />{% if link %}</a>{% endif -%} + {%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} + {%- if link %}<a href="{{link | safe}}">{% endif %}<img src="{{ path | safe }}{{ img | safe }}" class="img-main{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" />{% if link %}</a>{% endif %} {%- if caption %}<figcaption>{{caption}}</figcaption></figure>{%- endif %} {%- set img = swap_src | split(pat="/") | last %} - {%- set dirtest = swap_src | trim_start_matches(pat="./") %} - {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} + {%- set dirtest = swap_src | trim_start(pat="./") %} + {%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} - {%- if swap_src is starting_with("./") and reldir %} {# Relative Path #} - {%- set path = swap_src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} + {%- if swap_src is starting_with(pat="./") and reldir %} {# Relative Path #} + {%- set path = (swap_src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} {%- set path = path ~ "/" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ path ~ img) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ path ~ img %} {%- endif %} @@ -67,9 +68,9 @@ {%- set h = meta.height %} {%- endif %} - {%- elif swap_src is starting_with("/") %} {# Root Path #} - {%- set rootpath = swap_src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} + {%- elif swap_src is starting_with(pat="/") %} {# Root Path #} + {%- set rootpath = (swap_src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} {%- if not w or not h %} {%- set metapath = rootpath ~ "/" ~ img %} {%- set meta = get_image_metadata(path=metapath) %} @@ -80,8 +81,8 @@ {%- else %} {# Same Directory Path #} {%- set path = "" %} {%- if not w or not h %} - {%- if lang != config.default_language %} - {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %} + {%- if page.lang != config.default_language %} + {%- set metapath = (pagepath ~ img) | replace(from="/" ~ page.lang ~ "/", to="/") %} {%- else %} {%- set metapath = pagepath ~ img %} {%- endif %} @@ -94,7 +95,9 @@ {%- if not alt %} {%- set alt = img | split(pat=".") | first %} {%- endif %} - {%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} - {%- if link %}<a href="{{link | safe}}">{% endif %}<img src="{{ path | safe }}{{ img | safe }}" class="img-swap{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" />{% if link %}</a>{% endif -%} + {%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} + {%- if link %}<a href="{{link | safe}}">{% endif %}<img src="{{ path | safe }}{{ img | safe }}" class="img-swap{% if class %} {{class}}{% endif %}"{% if alt %} alt="{{alt}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} loading="lazy" />{% if link %}</a>{% endif %} {%- if caption %}<figcaption>{{caption}}</figcaption></figure>{%- endif %} </div> + +{% endcomponent imgswap %} diff --git a/templates/components/katex.html b/templates/components/katex.html new file mode 100644 index 0000000..71e27dd --- /dev/null +++ b/templates/components/katex.html @@ -0,0 +1,3 @@ +{% component katex(block=false) %} +<script type="math/tex{% if block %};mode=display{% endif %}">{{ body | safe }}</script> +{% endcomponent katex %} diff --git a/templates/components/showdata.html b/templates/components/showdata.html new file mode 100644 index 0000000..2aba3b1 --- /dev/null +++ b/templates/components/showdata.html @@ -0,0 +1,9 @@ +{%- component showdata(page, config, src, type="", key="") -%} +{%- if src and key and type -%} +{%- if src is matching(pat="^http[s]?://") -%}{%- set data = load_data(url=src, format=type) -%}{%- else -%}{%- set data = load_data(path=src, format=type) -%}{%- endif -%} +{{- data[key] }} +{%- else -%} +{%- if src is matching(pat="^http[s]?://") -%}{%- set data = load_data(url=src) -%}{%- else -%}{%- set data = load_data(path=src) -%}{%- endif -%} +{{- data }} +{%- endif -%} +{%- endcomponent showdata -%} diff --git a/templates/shortcodes/streamable.html b/templates/components/streamable.html index 7df8e9e..94dfc45 100644 --- a/templates/shortcodes/streamable.html +++ b/templates/components/streamable.html @@ -1,3 +1,5 @@ +{% component streamable(id, class="", title="") %} <div class="yv{% if class %} {{class}}{% endif %}"> <iframe src="https://www.streamable.com/e/{{id}}" title="{{title | default(value='Streamable') }}" class="yvi" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> +{% endcomponent streamable %} diff --git a/templates/components/video.html b/templates/components/video.html new file mode 100644 index 0000000..ee8130d --- /dev/null +++ b/templates/components/video.html @@ -0,0 +1,30 @@ +{% component video(page, config, sources, caption="", class="", w=0, h=0, autoplay=false, loop=false, muted=false, playsinline=false) %} +{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif %} +<video controls{% if class %} class="{{class}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %}{% if autoplay %} autoplay{% endif %}{% if loop %} loop{% endif %}{% if muted %} muted{% endif %}{% if playsinline %} playsinline{% endif %}> + {% for src in sources %} + + {%- set video = src | split(pat="/") | last %} + {%- set dirtest = src | trim_start(pat="./") %} + {%- if dirtest is containing(pat="/") %} {%- set reldir = true %} {%- endif %} + {%- if page and page.path %}{%- set pagepath = page.path %}{%- elif section and section.path %}{%- set pagepath = section.path %}{%- endif %} + + {%- if src is starting_with(pat="./") and reldir %}{# Relative Path #} + {%- set path = (src | trim_start(pat="./") | split(pat="/"))[:-1] | join(sep="/") | trim_start(pat="/") -%} + {%- set path = path ~ "/" %} + + {%- elif src is starting_with(pat="/") %}{# Root Path #} + {%- set rootpath = (src | split(pat="/"))[:-1] | join(sep="/") -%} + {%- set path = (config.base_url if config else "") ~ rootpath ~ "/" %} + + {%- else %}{# Same Directory Path #} + {%- set path = "" %} + + {%- endif %} + + {%- set type = src | split(pat=".") | last %} + {%- if type is matching(pat="^mov$") %}{% set type = "quicktime" %}{% endif %} + <source src="{{ path | safe }}{{ video | safe }}" type="{{ 'video/' ~ type }}" /> + {%- endfor -%}Your browser doesn't support the video tag and/or the video formats in use here – sorry!</video> +{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif %} + +{% endcomponent video %} diff --git a/templates/shortcodes/vimeo.html b/templates/components/vimeo.html index 0fe3129..d5a9e70 100644 --- a/templates/shortcodes/vimeo.html +++ b/templates/components/vimeo.html @@ -1,3 +1,5 @@ +{% component vimeo(id, class="", title="", autoplay=false, loop=false, noautopause=false, cookie=true) %} <div class="yv{% if class %} {{class}}{% endif %}"> <iframe src="https://player.vimeo.com/video/{{id}}?embedded=true{% if autoplay %}&autoplay=1{% endif %}{% if loop %}&loop=1{% endif %}{% if noautopause %}&autopause=0{% endif %}{% if not cookie %}&dnt=1{% endif %}" title="{{title | default(value='Vimeo') }}" class="yvi" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> +{% endcomponent vimeo %} diff --git a/templates/shortcodes/youtube.html b/templates/components/youtube.html index d07b91b..1022825 100644 --- a/templates/shortcodes/youtube.html +++ b/templates/components/youtube.html @@ -1,3 +1,5 @@ +{% component youtube(id, class="", title="", playlist="", autoplay=false, cookie=false) %} <div class="yv{% if class %} {{class}}{% endif %}"> <iframe src="https://www.youtube{% if not cookie %}-nocookie{% endif %}.com/embed/{{id}}{% if playlist %}?list={{playlist}}{% endif %}{% if autoplay %}?autoplay=1{% endif %}" title="{{title | default(value='Youtube') }}" class="yvi" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> +{% endcomponent youtube %} diff --git a/templates/index.html b/templates/index.html index e5da411..3c2c1b1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,44 +2,40 @@ This Template Shows a paginated page of the Posts of a section with a short summary. This Template can also be used directly for the index eg: example.com/ or as the rendering template for Sections, eg: example.com/blog/ example.com/software/ #} - {%- extends "base.html" %} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} -{%- block seo %} - {{- super() }} - - {%- if config.title %} - {%- set title = config.title %} - {%- else %} - {%- set title = "" %} - {%- endif %} - - {%- if config.extra.title_addition and title %} - {%- set title_addition = title_separator ~ config.extra.title_addition %} - {%- elif config.extra.title_addition %} - {%- set title_addition = config.extra.title_addition %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} -{%- endblock seo %} +{%- block seo -%} + {{- super() -}} + {%- if config.title -%} + {%- set title = config.title -%} + {%- else -%} + {%- set title = "" -%} + {%- endif -%} + {%- if config.extra.title_addition and title -%} + {%- set title_addition = title_separator ~ config.extra.title_addition -%} + {%- elif config.extra.title_addition -%} + {%- set title_addition = config.extra.title_addition -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_home={true} />}} +{%- endblock seo -%} {%- block content %} <div> - {%- for page in paginator.pages %} + {%- set pages = paginator.pages if paginator else section.pages %} + {% for page in pages %} <article> - {{- macros::title_index(page=page, config=config) }} - {%- if config.extra.meta_index.position %} - {%- if config.extra.meta_index.position == "top" or config.extra.meta_index.position == "both" %} - {{- macros::meta_index(page=page, config=config) }} + {{<title_index page={page} config={config} />}} + {%- if config.extra.meta_index?.position %} + {%- if config.extra.meta_index?.position == "top" or config.extra.meta_index?.position == "both" %} + {{<meta_index page={page} config={config} />}} {%- endif %}{%- endif %} <div class="sum"> <p> @@ -52,33 +48,33 @@ This Template can also be used directly for the index eg: example.com/ or as the {%- elif page.extra.static_thumbnail %} {%- endif %} <a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}"> - ...{{ macros::translate(key="more", default="more", i18n=i18n) }} + ...{{<translate key="more" default="more" i18n={i18n} />}} </a> </p> </div> - {%- if config.extra.meta_index.position %} - {%- if config.extra.meta_index.position == "bottom" or config.extra.meta_index.position == "both" %} - {{- macros::meta_index(page=page, config=config) }} + {%- if config.extra.meta_index?.position %} + {%- if config.extra.meta_index?.position == "bottom" or config.extra.meta_index?.position == "both" %} + {{<meta_index page={page} config={config} />}} {%- endif %} {%- endif %} </article> {%- endfor %} {%- if config.extra.arrow_pagination %} - {{- macros::pagination(paginator=paginator, config=config) }} + {%- if paginator %}{{<pagination paginator={paginator} config={config} />}}{% endif %} {%- else %} - {{- macros::numpagination(paginator=paginator, config=config) }} + {%- if paginator %}{{<numpagination paginator={paginator} config={config} />}}{% endif %} {%- endif %} </div> {%- if config.extra.recent | default(value=true) %} {#- The following line is checking if the template is being used for the root or a section #} - {%- if current_path is matching("^(/[[:alpha:]][[:alpha:]])?(/page/[[:digit:]]+)?/$") %} + {%- if current_path is matching(pat="^(/[[:alpha:]][[:alpha:]])?(/page/[[:digit:]]+)?/$") %} {%- set sec = "" %} {%- else %} {%- if lang == config.default_language %} - {%- set sec = current_path | trim_start_matches(pat="/") | split(pat="/page/") | slice(end=1) | join(sep="") | trim_end_matches(pat="/") %} + {%- set sec = current_path | trim_start(pat="/") | split(pat="/page/") | first | trim_end(pat="/") %} {%- set sec = sec ~ "/" %} {%- else %} - {%- set sec = current_path | trim_start_matches(pat="/" ~ lang ~ "/") | split(pat="/page/") | slice(end=1) | join(sep="") | trim_end_matches(pat="/") %} + {%- set sec = current_path | trim_start(pat="/" ~ lang ~ "/") | split(pat="/page/") | first | trim_end(pat="/") %} {%- set sec = sec ~ "/" %} {%- endif %} {%- endif %} @@ -90,10 +86,10 @@ This Template can also be used directly for the index eg: example.com/ or as the {%- endif %} <div class="sblock"> <div class="blockdiv sticky"> - <span class="b s150">{{ macros::translate(key="Recent", default="Recent", i18n=i18n) }}</span> + <span class="b s150">{{<translate key="Recent" default="Recent" i18n={i18n} />}}</span> {%- set recent_items=config.extra.recent_items | default(value=9) -%} - {%- for page in section_item.pages | slice(end=recent_items) %} - {{- macros::page_listing(page=page, config=config) }} + {%- for page in section_item.pages[:recent_items] -%} + {{<page_listing page={page} config={config} />}} {%- endfor %} </div> </div> diff --git a/templates/macros/seo.html b/templates/macros/seo.html deleted file mode 100644 index d8853be..0000000 --- a/templates/macros/seo.html +++ /dev/null @@ -1,145 +0,0 @@ -{#- type: website or article, generally setting article for blog articles -#} -{#- page_images: using for the blog single template page -#} -{#- page_section: the blog single template page have to pass the parameter -#} -{#- is_404: using for the 404.html template -#} - -{%- macro seo( config, title="", title_addition="", description="", type="website", is_home=false, is_404=false, is_page=false, page_images="", page_section="", created_time="2023-05-15T07:07:00-07:00", updated_time="2023-05-15T07:07:00-07:00" ) %} - -{#- Load current language i18n data from .toml files in user's '/i18n' folder, use theme as fallback. #} -{%- set i18n = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%} -{%- if not i18n -%}{%- set i18n = load_data(path="themes/abridge/i18n/" ~ lang ~ ".toml", required=false) -%}{%- endif %} -{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%} - -{%- if is_404 -%} - <meta name="robots" content="noindex, follow" /> -{%- else -%} - <meta name="robots" content="index, follow" /> - <meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> - <meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" /> -{%- endif -%} - -{%- if current_url %} - {%- set page_url = current_url %} -{%- else %} - {%- set page_url = get_url(path="404.html", trailing_slash=true) %} -{%- endif %} - <title>{{ title ~ title_addition }}</title> - -{%- if config.extra.author %} - <meta name="author" content="{{ config.extra.author }}" /> -{%- endif %} -{%- if config.extra.facebook_publisher %} - <meta property="article:publisher" content="https://www.facebook.com/{{ config.extra.facebook_publisher }}" /> -{%- endif %} - <meta name="copyright" content="{{ config.title }}" /> -{%- if config.extra.facebook_author %} - <meta property="article:author" content="https://www.facebook.com/{{ config.extra.facebook_author }}" /> -{%- endif %} -{%- if page.description %} - <meta name="description" content="{{ page.description }}" /> -{%- else %} - <meta name="description" content="{{ config.description }}" /> -{%- endif %} - <link rel="canonical" href="{{ page_url | safe }}" /> -{%- if page.extra.keywords and config.extra.keywords %} - <meta name="keywords" content="{{ page.extra.keywords }}, {{ config.extra.keywords }}" /> -{%- elif page.extra.keywords %} - <meta name="keywords" content="{{ page.extra.keywords }}" /> -{%- elif config.extra.keywords %} - <meta name="keywords" content="{{ config.extra.keywords }}" /> -{%- endif %} - -{#- Extra SEO START #} -{%- if config.extra.seo | default(value=true) %} -{%- if not is_404 %} - -{%- if config.extra.google %} - <meta name="google-site-verification" content="{{ config.extra.google | safe }}" /> -{%- endif %} - -{%- if config.extra.bing %} - <meta name="msvalidate.01" content="{{ config.extra.bing | safe}}" /> -{%- endif %} - <meta property="og:url" content="{{ page_url | safe }}" /> - <meta name="twitter:url" content="{{ page_url | safe }}" /> - -{%- if page.description %} - <meta property="og:description" content="{{ page.description }}" /> - <meta name="twitter:description" content="{{ page.description }}" /> -{%- else %} - <meta property="og:description" content="{{ config.description }}" /> - <meta name="twitter:description" content="{{ config.description}}" /> -{%- endif %} - -{%- if page.title %} - <meta property="og:title" content="{{ page.title }} | {{ config.title }}" /> - <meta name="twitter:title" content="{{ page.title }} | {{ config.title }}" /> -{%- else %} - <meta property="og:title" content="{{ config.title }}" /> - <meta name="twitter:title" content="{{ config.title }}" /> -{%- endif %} - - -{#- SEO MEDIA START #} -{%- if page.extra.thumbnail %} - <meta name="twitter:card" content="summary_large_image" /> - <meta name="twitter:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}" /> - <meta property="og:image" content="{{ get_url(path=page.path ~ page.extra.thumbnail, trailing_slash=false) }}" /> - -{%- elif page.extra.static_thumbnail %} - <meta name="twitter:card" content="summary_large_image" /> - {%- if page.extra.static_thumbnail is matching("^http[s]?://") %} - <meta name="twitter:image" content="{{ page.extra.static_thumbnail }}" /> - <meta property="og:image" content="{{ page.extra.static_thumbnail }}" /> - {%- else %} - <meta name="twitter:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}" /> - <meta property="og:image" content="{{ get_url(path=page.extra.static_thumbnail, trailing_slash=false) }}" /> - {%- endif %} - -{%- elif config.extra.banner %} - <meta name="twitter:card" content="summary_large_image" /> - <meta name="twitter:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}" /> - <meta property="og:image" content="{{ get_url(path=config.extra.banner, trailing_slash=false) }}" /> - -{%- else %} - <meta name="twitter:card" content="summary" /> - -{%- endif %} - -{%- if config.extra.open.audio %} - <meta property="og:audio" content="{{ config.extra.open.audio }}" /> -{%- endif %} - -{%- if config.extra.open.locale %} - <meta property="og:locale" content="{{ config.extra.open.locale }}" /> -{%- endif %} - -{%- if config.extra.open.videos %} - {%- for video in config.extra.open.videos %} - <meta property="og:video" content="{{ get_url(path=video) }}" /> - {%- endfor %} -{%- endif %} - -{#- SEO MEDIA END #} - <meta property="og:site_name" content="{{ config.title }}" /> - <meta property="og:locale" content="{{ lang_locale }}" /> - <meta property="og:type" content="website" /> -{%- if page.updated %} - <meta property="og:updated_time" content="{{ page.updated | date(format='%F') }}" /> -{%- elif page.date %} - <meta property="og:updated_time" content="{{ page.date | date(format='%F') }}" /> -{%- else %} - <meta property="og:updated_time" content="{{ updated_time }}" /> -{%- endif %} - -{%- if config.extra.twitter_meta %} - <meta name="twitter:site" content="@{{ config.extra.twitter_meta }}" /> - <meta name="twitter:creator" content="@{{ config.extra.twitter_meta }}" /> -{%- endif %} - - - -{%- endif %} -{%- endif %} -{#- Extra SEO END #} -{%- endmacro %} diff --git a/templates/page.html b/templates/page.html index 10ea571..6615602 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,43 +1,39 @@ -{# This Template Shows the Individual Blog Posts#} - -{% extends "base.html" %} - -{%- block seo %} - {{- super() }} - {%- set title_addition = "" %} - {%- if page.title and config.title %} - {%- set title = page.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- elif page.title %} - {%- set title = page.title %} - {%- else %} - {%- set title = config.title %} - {%- endif %} - - {%- if page.description %} - {%- set description = page.description %} - {%- else %} - {%- set description = config.description %} - {%- endif %} - {%- set created_time = page.date %} - {%- set updated_time = page.updated %} - {%- if current_section %} - {%- set page_section = current_section %} - {%- else %} - {%- set page_section = "" %} - {%- endif %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, type="article", is_page=true, created_time=created_time, updated_time=updated_time, page_section=page_section) }} -{%- endblock seo %} +{#- This Template Shows the Individual Blog Posts -#} +{%- extends "base.html" -%} +{%- block seo -%} + {{- super() -}} + {%- set title_addition = "" -%} + {%- if page.title and config.title -%} + {%- set title = page.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- elif page.title -%} + {%- set title = page.title -%} + {%- else -%} + {%- set title = config.title -%} + {%- endif -%} + {%- if page.description -%} + {%- set description = page.description -%} + {%- else -%} + {%- set description = config.description -%} + {%- endif -%} + {%- set created_time = page.date or "" -%} + {%- set updated_time = page.updated or page.date or "" -%} + {%- if current_section -%} + {%- set page_section = current_section -%} + {%- else -%} + {%- set page_section = "" -%} + {%- endif -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} type="article" is_page={true} created_time={created_time} updated_time={updated_time} page_section={page_section} />}} +{%- endblock seo -%} {%- block comments_init %} - {%- if not config.extra.comment_system or config.extra.comment_system == "hyvor" and config.extra.comments.hyvor %} + {%- if config.extra.comment_system == "hyvor" and config.extra.comments?.hyvor %} <script defer src="https://talk.hyvor.com/embed/embed.js" type="module"></script> - {%- elif config.extra.comment_system == "remark42" and config.extra.comments.remark42 %} + {%- elif config.extra.comment_system == "remark42" and config.extra.comments?.remark42 %} <script> var remark_config = { - host: "{{ config.extra.comments.remark42 | safe }}", - site_id: "{{ config.extra.comments.remark42_site_id }}", + host: "{{ config.extra.comments?.remark42 | safe }}", + site_id: "{{ config.extra.comments?.remark42_site_id }}", } </script> <script>!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);</script> @@ -46,63 +42,59 @@ {%- block content %} <article> + {%- block page_header -%} + {{<title_post page={page} config={config} />}} - {%- block page_header %} - {{- macros::title_post(page=page, config=config) }} - - {%- if config.extra.meta_post.position %} - {%- if config.extra.meta_post.position == "top" or config.extra.meta_post.position == "both" %} - {{- macros::meta_post(page=page, config=config) }} + {%- if config.extra.meta_post?.position %} + {%- if config.extra.meta_post?.position == "top" or config.extra.meta_post?.position == "both" %} + {{<meta_post page={page} config={config} />}} {%- endif %}{%- endif %} {%- endblock page_header %} - {# In Page Series Navigation #} + {#- In Page Series Navigation #} {%- if config.extra.series | default(value=true) %} {%- if page.extra.series %} {%- set tag = get_taxonomy_term(kind="tags", term=page.extra.series, lang=lang) %} - {%- set page_num = tag.page_count | as_str %} + {%- set page_num = tag.page_count | str %} {%- if lang != config.default_language %} - {%- set parts_string = macros::translate(key='Series_parts', default='Series', i18n=i18n) | replace(from="$NUMBER_OF_PARTS", to=page_num) %} - {% else %} + {%- set parts_string %}{{<translate key="Series_parts" default="Series" i18n={i18n} />}}{%- endset %} + {%- set parts_string = parts_string | replace(from="$NUMBER_OF_PARTS", to=page_num) %} + {%- else %} {%- set parts_string = config.extra.Series_parts | default(value="Series") | replace(from="$NUMBER_OF_PARTS", to=page_num) %} - {% endif -%} + {%- endif %} - <div class="block"> - <div class="blockdiv"> - <a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag.name }} ({{ parts_string }})</a><br> - {%- for inner in tag.pages | sort(attribute="date") %} - {%- if inner.content == page.content %} - <a class="scur" href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> - {%- set_global current_section_index = loop.index0 %} {# Finds the current section, needed for pagination logic later #} - {% else %} - <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> - {%- endif %} - {%- endfor %} + <div class="block"> + <div class="blockdiv"> + <a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ tag.name }} ({{ parts_string }})</a><br> + {%- for inner in tag.pages | sort(attribute="date") %} + {%- if inner.content == page.content %} + <a class="scur" href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> + {%- set_global current_section_index = loop.index0 %} {# Finds the current section, needed for pagination logic later #} + {%- else %} + <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> + {%- endif %} + {%- endfor %} + </div> </div> - </div> {%- endif %} {%- endif %} - {{ page.content | safe }} - - {%- if config.extra.meta_post.position %} - {%- if config.extra.meta_post.position == "bottom" or config.extra.meta_post.position == "both" %} - {{- macros::meta_post(page=page, config=config) }} + {%- if config.extra.meta_post?.position %} + {%- if config.extra.meta_post?.position == "bottom" or config.extra.meta_post?.position == "both" %} + {{<meta_post page={page} config={config} />}} {%- endif %}{%- endif %} {%- block page_footer %} - {{- macros::footer(page=page, config=config) }} + {{<footer page={page} config={config} />}} {%- endblock page_footer %} {%- block comments_body %} - {%- if not config.extra.comment_system or config.extra.comment_system == "hyvor" %} - {%- if config.extra.comments.hyvor %} - <hyvor-talk-comments website-id={{ config.extra.comments.hyvor }} page-id={{ page.slug }}{%- if config.extra.comments.hyvorcolor %} colors="{{ config.extra.comments.hyvorcolor }}"{%- endif %}></hyvor-talk-comments> - {%- endif %} - {%- elif config.extra.comment_system == "remark42" and config.extra.comments.remark42 %} + {%- if config.extra.comment_system == "hyvor" and config.extra.comments?.hyvor %} + <hyvor-talk-comments website-id={{ config.extra.comments?.hyvor }} page-id={{ page.slug }}{%- if config.extra.comments?.hyvorcolor %} colors="{{ config.extra.comments?.hyvorcolor }}"{%- endif %}></hyvor-talk-comments> + {%- elif config.extra.comment_system == "remark42" and config.extra.comments?.remark42 %} <div id="remark42"></div> {%- endif %} {%- endblock comments_body %} @@ -113,77 +105,75 @@ {%- set toc = page.toc %} {%- endif %} {%- if toc or page.extra.series %} - <div class="sblock"> {%- if page.extra.series %} {%- set num_extra_pages = config.extra.series_items | default(value=9) %} <div class="blockdiv"> <a class="b s150" href="{{ tag.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ parts_string }}</a><br> {%- if tag.page_count > num_extra_pages and num_extra_pages > 0 %} - {%- set sorted_array = tag.pages | sort(attribute="date") %} - {%- set num_pages = tag.page_count %} - - {# Shows the first page #} - {{ macros::series_link(inner=sorted_array.0, page=page, config=config) }} + {%- set sorted_array = tag.pages | sort(attribute="date") -%} + {%- set num_pages = tag.page_count %} + {#- Shows the first page -#} + {{<series_link inner={sorted_array[0]} page={page} config={config} />}} - {# Hides the next couple of pages if the current section is more than 3 away from start #} - {%- if current_section_index > 3 %} - <details> - <summary>{{ macros::translate(key="more", default="more", i18n=i18n) | title }}...</summary> - </details> - <div class="hidden_li"> - {%- for inner in sorted_array | slice(start=1, end=(current_section_index - 2)) %} - <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> - {%- endfor %} - </div> - {%- endif %} + {#- Hides the next couple of pages if the current section is more than 3 away from start #} + {%- if current_section_index > 3 %} + <details> + <summary>{% set _m %}{{<translate key="more" default="more" i18n={i18n} />}}{% endset %}{{ _m | title }}...</summary> + </details> + <div class="hidden_li"> + {%- for inner in sorted_array[1:(current_section_index - 2)] %} + <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> + {%- endfor %} + </div> + {%- endif %} - {# Max(current_section_index - 2, 1) #} + {#- Max(current_section_index - 2, 1) #} {%- if (current_section_index - 2 ) > 1 %} {%- set num = current_section_index - 2 %} {%- else %} {%- set num = 1 %} {%- endif %} - {# Shows two pages before current page #} - {%- for inner in sorted_array | slice(start=num, end=current_section_index) %} - <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> + {#- Shows two pages before current page #} + {%- for inner in sorted_array[num:current_section_index] %} + <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> {%- endfor %} - {# Shows the current page #} + {#- Shows the current page #} {%- if current_section_index != 0 and current_section_index != (num_pages - 1) %} - {{ macros::series_link(inner=sorted_array[current_section_index], page=page, config=config) }} + {{<series_link inner={sorted_array[current_section_index]} page={page} config={config} />}} {%- endif %} - {# Min(num_pages - 1, current_section_index + 3) #} + {#- Min(num_pages - 1, current_section_index + 3) #} {%- if (num_pages - 2 ) < (current_section_index + 3) %} {%- set num = num_pages - 1 %} {%- else %} {%- set num = current_section_index + 3 %} {%- endif %} - {%- for inner in sorted_array | slice(start=(current_section_index + 1), end=num ) %} + {%- for inner in sorted_array[(current_section_index + 1):num] %} <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> - {% endfor %} + {%- endfor %} {%- if current_section_index < num_pages - 4 %} <details> - <summary>{{ macros::translate(key="more", default="more", i18n=i18n) | title }}...</summary> + <summary>{% set _m %}{{<translate key="more" default="more" i18n={i18n} />}}{% endset %}{{ _m | title }}...</summary> </details> <div class="hidden_li"> - {%- for inner in sorted_array | slice(start=(current_section_index + 3), end=(num_pages - 1)) %} + {%- for inner in sorted_array[(current_section_index + 3):(num_pages - 1)] %} <a href="{{ inner.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ inner.title }}</a><br> {%- endfor %} </div> {%- endif %} - {%- set last = num_pages - 1%} - {{ macros::series_link(inner=sorted_array[last], page=page, config=config) }} + {%- set last = num_pages - 1 -%} + {{<series_link inner={sorted_array[last]} page={page} config={config} />}} - {# If there is not more than max pages render normally #} + {#- If there is not more than max pages render normally -#} {%- else %} {%- for inner in tag.pages | sort(attribute="date") %} - {{ macros::series_link(inner=inner, page=page, config=config) }} + {{<series_link inner={inner} page={page} config={config} />}} {%- endfor %} {%- endif %} </div> @@ -191,7 +181,7 @@ {%- if toc %} <div class="blockdiv sticky"> - <a class="b s150" href="#">{{ macros::translate(key="Index", default="Index", i18n=i18n) }}</a> + <a class="b s150" href="#">{{<translate key="Index" default="Index" i18n={i18n} />}}</a> {%- for h in toc %} <div> <a href="#{{h.id | safe}}">{{ h.title }}</a> diff --git a/templates/pages.html b/templates/pages.html index 72f4071..6d316cb 100644 --- a/templates/pages.html +++ b/templates/pages.html @@ -6,34 +6,31 @@ Some people prefer a landing page for the index, and then use a separate paginat {% extends "base.html" %} -{%- block seo %} - {{- super() }} - {%- set title_addition = "" %} - - {%- if page.title and config.title %} - {%- set title = page.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- elif section.title and config.title %} - {%- set title = section.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- elif page.title %} - {%- set title = page.title %} - {%- elif section.title %} - {%- set title = section.title %} - {%- else %} - {%- set title = config.title %} - {%- endif %} - - {%- if page.description %} - {%- set description = page.description %} - {%- elif section.description %} - {%- set description = section.description %} - {%- else %} - {%- set description = config.description %} - {%- endif %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description) }} -{%- endblock seo %} +{%- block seo -%} + {{- super() -}} + {%- set title_addition = "" -%} + {%- if page.title and config.title -%} + {%- set title = page.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- elif section.title and config.title -%} + {%- set title = section.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- elif page.title -%} + {%- set title = page.title -%} + {%- elif section.title -%} + {%- set title = section.title -%} + {%- else -%} + {%- set title = config.title -%} + {%- endif -%} + {%- if page.description -%} + {%- set description = page.description -%} + {%- elif section and section.description -%} + {%- set description = section.description -%} + {%- else -%} + {%- set description = config.description -%} + {%- endif -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} />}} +{%- endblock seo -%} {%- block content %} <div> diff --git a/templates/partials/head.html b/templates/partials/head.html index 668b811..e020404 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -21,7 +21,7 @@ <link rel="stylesheet" href="{{ get_url(path=i , trailing_slash=false, cachebust=true) | safe }}" /> {%- endfor %}{%- endif %} - {%- if page.extra.stylesheets %}{%- set pagestylesheets=page.extra.stylesheets -%}{%- endif %} + {%- if page?.extra?.stylesheets %}{%- set pagestylesheets=page?.extra?.stylesheets -%}{%- endif %} {%- if pagestylesheets %}{%- for i in pagestylesheets %} <link rel="stylesheet" href="{{ get_url(path=i , trailing_slash=false, cachebust=true) | safe }}" /> {%- endfor %}{%- endif %} @@ -98,7 +98,7 @@ {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set integrity = false %}{% endif %}{% endif %} {%- if config.extra.fonts %}{%- for i in config.extra.fonts %} - {%- if i.url is matching("^http[s]?://") %} + {%- if i.url is matching(pat="^http[s]?://") %} <link rel="preload" as="style" class="preStyle" href="{{ i.url | safe }}" crossorigin="anonymous" /> {%- else %} <link rel="preload" as="font" href="{{ get_url(path=i.url, trailing_slash=false) | safe }}" type="font/woff2" /> @@ -109,10 +109,10 @@ <link rel="preload" as="style" class="preStyle" href="{{ config.extra.fontawesome | safe }}" crossorigin="anonymous" /> {%- endif %} -{%- if config.extra.math or page.extra.math %} +{%- if config.extra.math or page?.extra?.math %} {%- set katex_css=config.extra.katex_css | default(value="katex.min.css") -%} - {%- if katex_css %}{%- if katex_css is matching("^http[s]?://") %} + {%- if katex_css %}{%- if katex_css is matching(pat="^http[s]?://") %} <link rel="preload" as="style" class="preStyle" href="{{ katex_css | safe }}"{%- if integrity and config.extra.katex_css_integrity %} integrity="{{ config.extra.katex_css_integrity | safe }}"{%- endif %} crossorigin="anonymous" /> {%- else %} <link rel="preload" as="style" class="preStyle" href="{{ get_url(path=katex_css, trailing_slash=false) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_css, sha_type=384, base64=true) | safe }}"{%- endif %} /> @@ -124,31 +124,19 @@ -{#- Rss / Atom Feed #} - - {%- if config.generate_feeds %} - {%- for feed in config.feed_filenames %} - - {%- if feed is containing('atom') %} +{#- Rss / Atom Feed -#} +{%- if config.generate_feeds -%} +{%- for feed in config.feed_filenames -%} +{%- if feed is containing(pat='atom') %} <link rel="alternate" type="application/atom+xml" title="{{ config.title }} Atom Feed" href="{{ get_url(path=feed, trailing_slash=false, lang=lang) | safe }}" /> - {%- endif %} - - {%- if feed is containing('rss') %} +{%- endif -%} +{%- if feed is containing(pat='rss') %} <link rel="alternate" type="application/rss+xml" title="{{ config.title }} RSS Feed" href="{{ get_url(path=feed, trailing_slash=false, lang=lang) | safe }}" /> - {%- endif %} - - {%- endfor %} - {%- endif %} - - - - - -{#- Extra items #} - {%- if config.extra.head_extra %} +{%- endif -%} +{%- endfor -%} +{%- endif -%} +{#- Extra items -#} +{%- if config.extra.head_extra %} {{ config.extra.head_extra | safe }} - {%- endif %} - - - +{%- endif -%} {#- End of head partial -#} diff --git a/templates/partials/head_js.html b/templates/partials/head_js.html index 2a16b6d..af82de8 100644 --- a/templates/partials/head_js.html +++ b/templates/partials/head_js.html @@ -1,36 +1,36 @@ -{#- JAVASCRIPT #} +{#- JAVASCRIPT -#} {%- set integrity = config.extra.integrity | default(value=true) -%} - {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set integrity = false %}{% endif %}{% endif %} + {%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{%- set integrity = false -%}{%- endif -%}{%- endif -%} {%- set search_library=config.extra.search_library | default(value="elasticlunr") -%} - {%- set preStyle = false %} + {%- set preStyle = false -%} - {%- if config.extra.fonts %}{%- for i in config.extra.fonts %} - {%- if i.url is matching("^http[s]?://") %} - {%- set preStyle = true %} - {%- endif %} - {%- endfor %}{%- endif %} + {%- if config.extra.fonts -%}{%- for i in config.extra.fonts -%} + {%- if i.url is matching(pat="^http[s]?://") -%} + {%- set preStyle = true -%} + {%- endif -%} + {%- endfor -%}{%- endif -%} - {%- if config.extra.fontawesome %} - {%- set preStyle = true %} - {%- endif %} + {%- if config.extra.fontawesome -%} + {%- set preStyle = true -%} + {%- endif -%} - {%- if config.extra.math or page.extra.math %} + {%- if config.extra.math or page?.extra?.math -%} {%- set katex_css=config.extra.katex_css | default(value="katex.min.css") -%} - {%- if katex_css %} - {%- set preStyle = true %} - {%- endif %} - {%- endif %} + {%- if katex_css -%} + {%- set preStyle = true -%} + {%- endif -%} + {%- endif -%} -{%- if config.mode != "serve" -%}{%- set notserve = true %}{%- endif %} -{%- if config.extra.js_bundle %} +{%- if config.mode != "serve" -%}{%- set notserve = true -%}{%- endif -%} +{%- if config.extra.js_bundle -%} - {%- if config.build_search_index %} + {%- if config.build_search_index -%} {%- if notserve and config.extra.pwa | default(value=false) %} <script defer src="{{ get_url(path='js/abridge.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/abridge.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- else %} <script defer src="{{ get_url(path='js/abridge_nopwa.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/abridge_nopwa.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> - {%- endif %} + {%- endif -%} {%- else %} {%- if notserve and config.extra.pwa | default(value=false) %} @@ -117,7 +117,7 @@ {#- https://katex.org/docs/autorender.html #} {#- https://github.com/KaTeX/KaTeX/ #} {#- https://github.com/KaTeX/KaTeX/tree/main/contrib/mathtex-script-type/ #} -{%- if config.extra.math or page.extra.math %} +{%- if config.extra.math or page?.extra?.math %} {%- set katex_bundle=config.extra.katex_bundle | default(value="js/katexbundle.min.js") -%} {%- if katex_bundle %} @@ -125,23 +125,23 @@ {%- else %} {%- set katex_js=config.extra.katex_js | default(value="js/katex.min.js") -%} - {%- if katex_js %}{%- if katex_js is matching("^http[s]?://") %} + {%- if katex_js %}{%- if katex_js is matching(pat="^http[s]?://") %} <script defer src="{{ katex_js | safe }}"{%- if integrity and config.extra.katex_js_integrity %} integrity="{{ config.extra.katex_js_integrity | safe }}"{%- endif %} crossorigin="anonymous"></script> {%- else %} <script defer src="{{ get_url(path=katex_js , trailing_slash=false, cachebust=true) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_js, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %}{%- endif %} {%- set mathtex_js=config.extra.mathtex_js | default(value="js/mathtex-script-type.min.js") -%} - {%- if mathtex_js %}{%- if mathtex_js is matching("^http[s]?://") %} + {%- if mathtex_js %}{%- if mathtex_js is matching(pat="^http[s]?://") %} <script defer src="{{ mathtex_js | safe }}"{%- if integrity and config.extra.mathtex_js_integrity %} integrity="{{ config.extra.mathtex_js_integrity | safe }}"{%- endif %} crossorigin="anonymous"></script> {%- else %} <script defer src="{{ get_url(path=mathtex_js , trailing_slash=false, cachebust=true) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=mathtex_js, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %}{%- endif %} - {%- if config.extra.math_auto_render or page.extra.math_auto_render %} + {%- if config.extra.math_auto_render or page?.extra?.math_auto_render %} {%- set katex_autorender_js=config.extra.katex_autorender_js | default(value="js/katex-auto-render.min.js") -%} {%- if katex_autorender_js %} - {%- if katex_autorender_js is matching("^http[s]?://") %} + {%- if katex_autorender_js is matching(pat="^http[s]?://") %} <script defer src="{{ katex_autorender_js | safe }}"{%- if integrity and config.extra.katex_autorender_js_integrity %} integrity="{{ config.extra.katex_autorender_js_integrity | safe }}"{%- endif %} crossorigin="anonymous"></script> {%- else %} <script defer src="{{ get_url(path=katex_autorender_js , trailing_slash=false, cachebust=true) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_autorender_js, sha_type=384, base64=true) | safe }}"{%- endif %}></script> @@ -161,4 +161,4 @@ -{#- End of head_js partial -#} +{#- End of head_js partial #} diff --git a/templates/partials/social.html b/templates/partials/social.html index 73e8bb2..a44142a 100644 --- a/templates/partials/social.html +++ b/templates/partials/social.html @@ -3,9 +3,9 @@ {%- if config.generate_feeds and config.extra.feed -%} {%- for feed in config.feed_filenames -%} - {%- if feed is containing('atom') -%} + {%- if feed is containing(pat='atom') -%} <a type="application/atom+xml" href="{{ get_url(path=feed, trailing_slash=false, lang=lang) | safe }}" target="_blank" title="{{ config.title }} Atom Feed"><i type="Button" class="svg rss" title="{{ config.title }} Atom Feed"></i></a>{% endif -%} - {%- if feed is containing('rss') -%} + {%- if feed is containing(pat='rss') -%} <a type="application/rss+xml" href="{{ get_url(path=feed, trailing_slash=false, lang=lang) | safe }}" target="_blank" title="{{ config.title }} RSS Feed"><i type="Button" class="svg rss" title="{{ config.title }} RSS Feed"></i></a>{% endif -%} {%- endfor -%} diff --git a/templates/shortcodes/audio.html b/templates/shortcodes/audio.html deleted file mode 100644 index 2d6eda9..0000000 --- a/templates/shortcodes/audio.html +++ /dev/null @@ -1,29 +0,0 @@ -{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} -<audio controls{% if class %} class="{{class}}"{% endif %}{% if autoplay %} autoplay{% endif %}{% if loop %} loop{% endif %}{% if muted %} muted{% endif %}{% if playsinline %} playsinline{% endif %}> - {% for src in sources -%} - - {%- set file = src | split(pat="/") | last %} - {%- set dirtest = src | trim_start_matches(pat="./") %} - {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} - {%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} - - {%- if src is starting_with("./") and reldir %}{# Relative Path #} - {%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} - {%- set path = path ~ "/" %} - - {%- elif src is starting_with("/") %}{# Root Path #} - {%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} - - {%- else %}{# Same Directory Path #} - {%- set path = "" %} - - {%- endif %} - - {%- set type = src | split(pat=".") | last -%} - {%- if type is matching("^mov$") %}{% set type = "quicktime" %}{% endif -%} - <source src="{{ path | safe }}{{ file | safe }}" type="{{ 'audio/' ~ type }}" /> - {% endfor -%} - Your browser doesn't support the audio tag and/or the audio formats in use here – sorry! -</audio> -{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif -%} diff --git a/templates/shortcodes/gif.html b/templates/shortcodes/gif.html deleted file mode 100644 index 430ba89..0000000 --- a/templates/shortcodes/gif.html +++ /dev/null @@ -1,29 +0,0 @@ -{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} -<video controls{% if class %} class="{{class}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %} autoplay loop muted playsinline> - {% for src in sources -%} - - {%- set video = src | split(pat="/") | last %} - {%- set dirtest = src | trim_start_matches(pat="./") %} - {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} - {%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} - - {%- if src is starting_with("./") and reldir %}{# Relative Path #} - {%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} - {%- set path = path ~ "/" %} - - {%- elif src is starting_with("/") %}{# Root Path #} - {%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} - - {%- else %}{# Same Directory Path #} - {%- set path = "" %} - - {%- endif %} - - {%- set type = src | split(pat=".") | last -%} - {%- if type is matching("^mov$") %}{% set type = "quicktime" %}{% endif -%} - <source src="{{ path | safe }}{{ video | safe }}" type="{{ 'video/' ~ type }}" /> - {% endfor -%} - Your browser doesn't support the video tag and/or the video formats in use here – sorry! -</video> -{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif -%} diff --git a/templates/shortcodes/katex.html b/templates/shortcodes/katex.html deleted file mode 100644 index 9b9a1f7..0000000 --- a/templates/shortcodes/katex.html +++ /dev/null @@ -1 +0,0 @@ -<script type="math/tex{% if block %};mode=display{% endif %}">{{body | safe}}</script> diff --git a/templates/shortcodes/showdata.html b/templates/shortcodes/showdata.html deleted file mode 100644 index 7f3d3bc..0000000 --- a/templates/shortcodes/showdata.html +++ /dev/null @@ -1,18 +0,0 @@ -{# showdata(src="../theme.toml" type="toml" key="min_version") #} - -{%- if src and key and type %} - {%- if src is matching("^http[s]?://") %} - {% set data = load_data(url=src, format=type) %} - {%- else %} - {% set data = load_data(path=src, format=type) %} - {%- endif %} - {{ data[key] }} -{%- else %} - {# Load other file types as plain text #} - {%- if src is matching("^http[s]?://") %} - {% set data = load_data(url=src) %} - {%- else %} - {% set data = load_data(path=src) %} - {%- endif %} - {{ data }} -{%- endif %} diff --git a/templates/shortcodes/video.html b/templates/shortcodes/video.html deleted file mode 100644 index 9d33f28..0000000 --- a/templates/shortcodes/video.html +++ /dev/null @@ -1,29 +0,0 @@ -{%- if caption %}<figure class="fi{% if class %} {{class}}{% endif %}">{% endif -%} -<video controls{% if class %} class="{{class}}"{% endif %}{% if w %} width="{{w}}"{% endif %}{% if h %} height="{{h}}"{% endif %}{% if autoplay %} autoplay{% endif %}{% if loop %} loop{% endif %}{% if muted %} muted{% endif %}{% if playsinline %} playsinline{% endif %}> - {% for src in sources -%} - - {%- set video = src | split(pat="/") | last %} - {%- set dirtest = src | trim_start_matches(pat="./") %} - {%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %} - {%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %} - - {%- if src is starting_with("./") and reldir %}{# Relative Path #} - {%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %} - {%- set path = path ~ "/" %} - - {%- elif src is starting_with("/") %}{# Root Path #} - {%- set rootpath = src | split(pat="/") | slice(end=-1) | join(sep="/") %} - {%- set path = config.base_url ~ rootpath ~ "/" %} - - {%- else %}{# Same Directory Path #} - {%- set path = "" %} - - {%- endif %} - - {%- set type = src | split(pat=".") | last -%} - {%- if type is matching("^mov$") %}{% set type = "quicktime" %}{% endif -%} - <source src="{{ path | safe }}{{ video | safe }}" type="{{ 'video/' ~ type }}" /> - {% endfor -%} - Your browser doesn't support the video tag and/or the video formats in use here – sorry! -</video> -{%- if caption %}<figcaption>{{caption}}</figcaption></figure>{% endif -%} diff --git a/templates/tags/list.html b/templates/tags/list.html index 901beea..0f3488a 100644 --- a/templates/tags/list.html +++ b/templates/tags/list.html @@ -1,26 +1,21 @@ -{% extends "base.html" %} +{%- extends "base.html" -%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - -{%- block seo %} - {{- super() }} - {%- set title = "Tags" %} - - {%- if config.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} -{%- endblock seo %} - +{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} +{%- block seo -%} + {{- super() -}} + {%- set title = "Tags" -%} + {%- if config.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_home={true} />}} +{%- endblock seo -%} {%- block content %} <div> <div class="c"> - <h1>{{ terms | length }} {{ macros::translate(key="Tags", default="Tags", i18n=i18n) }} </h1> + <h1>{{ terms | length }} {{<translate key="Tags" default="Tags" i18n={i18n} />}} </h1> <p>{% for term in terms %} #<a href="#{{ term.name }}">{{ term.name }}</a><sup>{{ term.pages | length }}</sup> {% endfor %}</p> </div> {%- for term in terms %} diff --git a/templates/tags/single.html b/templates/tags/single.html index eb1d77a..b507ceb 100644 --- a/templates/tags/single.html +++ b/templates/tags/single.html @@ -1,22 +1,17 @@ -{% extends "base.html" %} +{%- extends "base.html" -%} {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} -{%- if config.extra.search_library %}{%- if config.extra.search_library == "offline" %}{% set uglyurls = true %}{% endif %}{% endif %} - -{%- block seo %} - {{- super() }} - {%- set title = term.name ~ " tag" %} - - {%- if config.title %} - {%- set title_addition = title_separator ~ config.title %} - {%- else %} - {%- set title_addition = "" %} - {%- endif %} - - {%- set description = config.description %} - - {{- macros_seo::seo(config=config, title=title, title_addition=title_addition, description=description, is_home=true) }} -{%- endblock seo %} - +{%- if config.extra.search_library -%}{%- if config.extra.search_library == "offline" -%}{%- set uglyurls = true -%}{%- endif -%}{%- endif -%} +{%- block seo -%} + {{- super() -}} + {%- set title = term.name ~ " tag" -%} + {%- if config.title -%} + {%- set title_addition = title_separator ~ config.title -%} + {%- else -%} + {%- set title_addition = "" -%} + {%- endif -%} + {%- set description = config.description -%} + {{<seo config={config} title={title} title_addition={title_addition} description={description or ""} is_home={true} />}} +{%- endblock seo -%} {%- block content %} <div> <h2>{{ term.name }}</h2> |
