mirror of
https://github.com/welpo/tabi.git
synced 2025-10-10 23:38:53 +02:00
Section support for info-page.html
This change makes it possible to use the page-info.html template on the root path "/", which in zola is always a "section" and can't be set to "page".
This commit is contained in:
parent
e05860636b
commit
0286c3a800
2 changed files with 15 additions and 8 deletions
|
@ -4,13 +4,15 @@
|
|||
|
||||
{%- block main_content %}
|
||||
|
||||
{{ macros_page_header::page_header(title=page.title) }}
|
||||
{%- set page_or_section = page | default(value=section) -%}
|
||||
|
||||
{{ macros_page_header::page_header(title=page_or_section.title) }}
|
||||
|
||||
<div id="page-content">
|
||||
<main>
|
||||
{# The replace pattern is used to enable arbitrary locations for the Table of Contents #}
|
||||
{# This is Philipp Oppermann's workaround: https://github.com/getzola/zola/issues/584#issuecomment-474329637 #}
|
||||
{{ page.content | replace(from="<!-- toc -->", to=macros_toc::toc(page=page, header=false, language_strings=language_strings)) | safe }}
|
||||
{{ page_or_section.content | replace(from="<!-- toc -->", to=macros_toc::toc(page=page_or_section, header=false, language_strings=language_strings)) | safe }}
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
{%- set page_or_section = page | default(value=section) -%}
|
||||
|
||||
{# prepare parameters for evaluate_setting_priority macro #}
|
||||
{%- set page_s = page | default(value="") -%}
|
||||
{%- set section_s = section | default(value="") -%}
|
||||
|
||||
{# Quick navigation buttons #}
|
||||
{% if macros_settings::evaluate_setting_priority(setting="quick_navigation_buttons", page=page_or_section, default_global_value=false) == "true" %}
|
||||
{% if macros_settings::evaluate_setting_priority(setting="quick_navigation_buttons", page=page_s, section=section_s, default_global_value=false) == "true" %}
|
||||
<div id="button-container">
|
||||
{# Button to go show a floating Table of Contents #}
|
||||
{% if page_or_section.toc %}
|
||||
|
@ -31,13 +36,13 @@
|
|||
{% endif %}
|
||||
|
||||
{# Add KaTeX functionality #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="katex", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="katex", page=page_s, section=section_s, default_global_value=false) == "true" -%}
|
||||
<link rel="stylesheet" href="{{ get_url(path='katex.min.css', trailing_slash=false) | safe }}">
|
||||
<script defer src="{{ get_url(path='js/katex.min.js', trailing_slash=false) | safe }}"></script>
|
||||
{%- endif -%}
|
||||
|
||||
{# Load mermaid.js #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="mermaid", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="mermaid", page=page_s, section=section_s, default_global_value=false) == "true" -%}
|
||||
{%- if config.extra.serve_local_mermaid | default(value=true) -%}
|
||||
<script defer src="{{ get_url(path='js/mermaid.min.js', trailing_slash=false) | safe }}"></script>
|
||||
{%- else -%}
|
||||
|
@ -46,7 +51,7 @@
|
|||
{%- endif -%}
|
||||
|
||||
{# Add copy button to code blocks #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="copy_button", page=page_or_section, default_global_value=true) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="copy_button", page=page_s, section=section_s, default_global_value=true) == "true" -%}
|
||||
{#- Add hidden HTML elements with the translated strings for the button's interactions -#}
|
||||
<span id="copy-success" class="hidden">
|
||||
{{ macros_translate::translate(key="copied", default="Copied!", language_strings=language_strings) }}
|
||||
|
@ -58,11 +63,11 @@
|
|||
{%- endif -%}
|
||||
|
||||
{# JavaScript to use the "Show source or path" on code blocks shortcode: https://welpo.github.io/tabi/blog/shortcodes/#show-source-or-path #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="add_src_to_code_block", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="add_src_to_code_block", page=page_s, section=section_s, default_global_value=false) == "true" -%}
|
||||
<script defer src="{{ get_url(path='js/addSrcToCodeBlock.min.js', trailing_slash=false) | safe }}"></script>
|
||||
{%- endif -%}
|
||||
|
||||
{# Add backlinks to footnotes #}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="footnote_backlinks", page=page_or_section, default_global_value=false) == "true" -%}
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="footnote_backlinks", page=page_s, section=section_s, default_global_value=false) == "true" -%}
|
||||
<script defer src="{{ get_url(path='js/footnoteBacklinks.min.js', trailing_slash=false | safe )}}"></script>
|
||||
{%- endif -%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue