diff options
| author | Jieiku | 2023-09-08 15:08:39 -0700 |
|---|---|---|
| committer | Jieiku | 2023-09-08 15:08:39 -0700 |
| commit | 5e55301cc2c91a5f0e99000bfe4d7ec262ee78c1 (patch) | |
| tree | d034c24a0debdb22066c659fa67ab5564227acdd /templates | |
| parent | 288de9dac39869ac94d0265351f5884a78dce5a8 (diff) | |
| download | abridge-2.2.0.tar.gz abridge-2.2.0.tar.bz2 abridge-2.2.0.zip | |
Refactor package.json2.2.0
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/404.html | 6 | ||||
| -rw-r--r-- | templates/archive.html | 6 | ||||
| -rw-r--r-- | templates/base.html | 17 | ||||
| -rw-r--r-- | templates/categories/list.html | 6 | ||||
| -rw-r--r-- | templates/categories/single.html | 4 | ||||
| -rw-r--r-- | templates/index.html | 4 | ||||
| -rw-r--r-- | templates/macros/head.html | 87 | ||||
| -rw-r--r-- | templates/macros/macros.html | 44 | ||||
| -rw-r--r-- | templates/macros/page.html | 4 | ||||
| -rw-r--r-- | templates/tags/list.html | 6 | ||||
| -rw-r--r-- | templates/tags/single.html | 4 |
11 files changed, 115 insertions, 73 deletions
diff --git a/templates/404.html b/templates/404.html index 27e9148..7b7c325 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{ super() }} @@ -19,12 +21,12 @@ <div> <h1>404 :(</h1> {#- Default English message #} - <p>Page not found, maybe moved{% if config.languages | length > 1 %} or not in this language{% endif %}. {% if config.build_search_index %}Try searching or {% endif %}<a href="{{ config.base_url | safe }}/{%- if config.extra.uglyurls %}index.html{%- endif %}">go to homepage</a>.</p> + <p>Page not found, maybe moved{% if config.languages | length > 1 %} or not in this language{% endif %}. {% if config.build_search_index %}Try searching or {% endif %}<a href="{{ config.base_url | safe }}/{%- if uglyurls %}index.html{%- endif %}">go to homepage</a>.</p> {# Iterate through each language and display the localised 404 message #} {%- for lcode, language in config.languages -%} {%- if lcode != config.default_language -%} - <p>{{ trans(key="404_not_found", lang=lcode) }}. {% if config.build_search_index %}{{ trans(key="404_try_search", lang=lcode) }}{% endif %} <a href="{{ config.base_url }}/{{ lcode }}/{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ trans(key="404_go_home", lang=lcode) }}</a>.</p> + <p>{{ trans(key="404_not_found", lang=lcode) }}. {% if config.build_search_index %}{{ trans(key="404_try_search", lang=lcode) }}{% endif %} <a href="{{ config.base_url }}/{{ lcode }}/{%- if uglyurls %}index.html{%- endif %}">{{ trans(key="404_go_home", lang=lcode) }}</a>.</p> {%- endif -%} {%- endfor -%} </div> diff --git a/templates/archive.html b/templates/archive.html index eff70a9..8ac3cfc 100644 --- a/templates/archive.html +++ b/templates/archive.html @@ -4,6 +4,8 @@ This Template can also be used as the rendering template for Sections, eg: examp #} {% extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{- super() }} @@ -62,7 +64,7 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- endif %} {%- endif %} {%- for post in posts %} - <p><a href="{{ post.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ post.title }}</a>{%- if not hide_section_dates %} - <time datetime="{{ post.date }}">{{ post.date | date(format="%F") }}</time>{%- endif %}</p> + <p><a href="{{ post.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ post.title }}</a>{%- if not hide_section_dates %} - <time datetime="{{ post.date }}">{{ post.date | date(format="%F") }}</time>{%- endif %}</p> {%- endfor %} {%- endfor %} {%- else %} @@ -75,7 +77,7 @@ This Template can also be used as the rendering template for Sections, eg: examp {%- endif %} {%- endif %} {%- for post in posts %} - <p><a href="{{ post.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ post.title }}</a>{%- if not hide_section_dates %} - <time datetime="{{ post.date }}">{{ post.date | date(format="%F") }}</time>{%- endif %}</p> + <p><a href="{{ post.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ post.title }}</a>{%- if not hide_section_dates %} - <time datetime="{{ post.date }}">{{ post.date | date(format="%F") }}</time>{%- endif %}</p> {%- endfor %} {%- endfor %} {%- endif %} diff --git a/templates/base.html b/templates/base.html index db58b72..8d85516 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,6 +2,8 @@ {%- import "macros/social.html" as social_macros %} {%- import "macros/page.html" as page_macros %} {%- import "macros/macros.html" as macros %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} <!DOCTYPE html> <html lang="{%- if lang != config.default_language %}{{ lang }}{% else %}{{ config.extra.language_code | default(value=lang) }}{% endif %}"> <head> @@ -27,7 +29,6 @@ <meta name="apple-mobile-web-app-status-bar-style" content="default" /> {{- macros_head::security(config=config) }} {{- macros_head::favicons(config=config) }} - {{- macros_head::pwa(config=config) }} {%- block comments_init %} {%- endblock comments_init %} <noscript><link rel="stylesheet" href="{{ get_url(path='nojs.css', trailing_slash=false) | safe }}" /></noscript> @@ -38,18 +39,18 @@ <nav> <div> {%- if config.extra.logo -%} - <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if config.extra.uglyurls %}/index.html{%- endif %}"> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- 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 }}"{%- 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 -%} </a></h1> {%- elif config.extra.textlogo -%} - <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if config.extra.uglyurls -%} + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls -%} {%- if lang == config.default_language -%}/{%- endif -%} index.html{%- endif -%}">{{ config.extra.textlogo | safe }}</a></h1> {%- elif config.title -%} - <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if config.extra.uglyurls %}/index.html{%- endif %}">{{ config.title | safe }}</a></h1> + <h1><a href="{{ get_url(path="/", lang=lang) }}{%- if uglyurls %}/index.html{%- endif %}">{{ config.title | safe }}</a></h1> {%- endif -%} </div> <div> @@ -57,7 +58,7 @@ {%- if config.extra.menu or js_switcher %} {%- if config.extra.menu %} {%- for i in config.extra.menu -%} - <a href="{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and config.extra.uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> + <a href="{{ get_url(path=i.url, lang=lang, trailing_slash=i.slash) }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}> {%- if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif -%} </a> {%- endfor -%} @@ -74,9 +75,9 @@ {%- for lcode,flag in config.extra.flag -%} {%- if lang != lcode -%} {%- if lcode == config.default_language -%} - <a type="Button" href="{{ current_url | replace(from=current_path | truncate(length=4, end=""), to="/") | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> + <a type="Button" href="{{ current_url | replace(from=current_path | truncate(length=4, end=""), to="/") | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> {%- else -%} - <a type="Button" href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> + <a type="Button" href="{{ current_url | replace(from=config.base_url, to=config.base_url ~ "/" ~ lcode) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ flag }}</a><br /> {%- endif -%} {%- endif -%} {%- endfor -%} @@ -145,7 +146,7 @@ {%- else %} {%- set furl=get_url(path=i.url, trailing_slash=i.slash) %} {%- endif %} - <a{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %} href="{{ furl | safe }}{%- if i.slash and config.extra.uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif %}</a> + <a{%- if config.extra.footer_size %} class="{{ config.extra.footer_size }}"{% endif %} href="{{ furl | safe }}{%- if i.slash and uglyurls %}index.html{%- endif %}"{% if i.blank %} target="_blank"{% endif %}>{% if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif %}</a> {%- endfor %} </nav> {%- endif %} diff --git a/templates/categories/list.html b/templates/categories/list.html index 2e325c9..bbfb6dc 100644 --- a/templates/categories/list.html +++ b/templates/categories/list.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{- super() }} @@ -22,9 +24,9 @@ <p>{% for term in terms %} [<a href="#{{ term.name }}">{{ term.name }}</a>]<sup>{{ term.pages | length }}</sup> {% endfor %}</p> </div> {%- for term in terms %} - <h2 id="{{ term.name }}"><a href="{{ term.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ term.name }}</a></h2> + <h2 id="{{ term.name }}"><a href="{{ term.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ term.name }}</a></h2> {%- for page in term.pages %} - <p><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> + <p><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> {%- endfor %} {%- endfor %} </div> diff --git a/templates/categories/single.html b/templates/categories/single.html index 9e667b4..7e85232 100644 --- a/templates/categories/single.html +++ b/templates/categories/single.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{- super() }} @@ -21,7 +23,7 @@ {%- for year, posts in term.pages | group_by(attribute="year") %} <h3>{{ year }}</h3> {%- for page in posts %} - <p><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> + <p><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> {%- endfor %} {%- endfor %} </div> diff --git a/templates/index.html b/templates/index.html index ce224c0..a364912 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,6 +4,8 @@ This Template can also be used as the rendering template for Sections, eg: examp #} {%- extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{- super() }} @@ -48,7 +50,7 @@ This Template can also be used as the rendering template for Sections, eg: examp {{ page.content | striptags | truncate(length=150) | safe }} {%- elif page.extra.static_thumbnail %} {%- endif %} - <a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">...more</a> + <a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">...more</a> </div> {%- if config.extra.meta_index.position %} {%- if config.extra.meta_index.position == "bottom" or config.extra.meta_index.position == "both" %} diff --git a/templates/macros/head.html b/templates/macros/head.html index fe4eb53..cea56c8 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -1,22 +1,17 @@ {#- Theme Switcher Button to toggle between dark/light #} {%- macro theme(config) %} + {%- set integrity = config.extra.integrity | default(value=true) -%} + {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + {%- if config.extra.js_switcher | default(value=true) %} {%- set js_theme="js/theme.min.js" %} {%- if config.extra.js_switcher_default %} {%- if config.extra.js_switcher_default == "light" %}{% set js_theme="js/theme_light.min.js" %}{% endif %} {%- endif %} - <script src="{{ get_url(path=js_theme , trailing_slash=false) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=js_theme, sha_type=384, base64=true) | safe }}"{%- endif %}></script> - {%- endif %} -{%- endmacro %} - -{#- Service Worker for PWA #} -{%- macro pwa(config) %} - {%- if config.extra.pwa | default(value=false) %} - <script defer src="{{ get_url(path='js/sw_load.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/sw_load.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script src="{{ get_url(path=js_theme , trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=js_theme, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- endmacro %} - {%- macro stylesheets(config) %} {%- set stylesheets=config.extra.stylesheets | default(value=[ "abridge.css" ]) -%} {%- if stylesheets %}{%- for i in stylesheets %} @@ -27,6 +22,8 @@ {%- macro stylesheets_preload(config) %} + {%- set integrity = config.extra.integrity | default(value=true) -%} + {%- if config.extra.offline %}{% set integrity = false %}{% endif %} {%- if config.extra.fonts %}{%- for i in config.extra.fonts %} {%- if i.url is matching("^http[s]?://") %} @@ -44,9 +41,9 @@ {%- set katex_css=config.extra.katex_css | default(value="katex.min.css") -%} {%- if katex_css %}{%- if katex_css is matching("^http[s]?://") %} - <link rel="preload" as="style" class="preStyle" href="{{ katex_css | safe }}"{%- if config.extra.integrity | default(value=true) and config.extra.katex_css_integrity %} integrity="{{ config.extra.katex_css_integrity | safe }}"{%- endif %} crossorigin="anonymous" /> + <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 config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=katex_css, sha_type=384, base64=true) | safe }}"{%- endif %} /> + <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 %} /> {%- endif %}{%- endif %} {%- endif %} @@ -64,6 +61,8 @@ {%- macro js(config) %} + {%- set integrity = config.extra.integrity | default(value=true) -%} + {%- if config.extra.offline %}{% set integrity = false %}{% endif %} {%- set search_library=config.extra.search_library | default(value="elasticlunr") -%} {%- set preStyle = false %} @@ -88,16 +87,25 @@ {%- if config.extra.js_bundle %} {%- if config.build_search_index %} - <script defer src="{{ get_url(path='js/abridge.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/abridge.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- if 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 %} + + {%- else %} + {%- if config.extra.pwa | default(value=false) %} + <script defer src="{{ get_url(path='js/abridge_nosearch.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/abridge_nosearch.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- else %} - <script defer src="{{ get_url(path='js/abridge_nosearch.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/abridge_nosearch.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/abridge_nosearch_nopwa.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/abridge_nosearch_nopwa.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} {%- endif %} {%- if config.build_search_index %} {%- if search_library == "elasticlunr" %} {%- if lang != "en" %} - <script defer src="{{ get_url(path='js/lunr.stemmer.support.min.js', trailing_slash=false) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/lunr.stemmer.support.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> - <script defer src="{{ get_url(path='js/lunr.' ~ lang ~ '.min.js' , trailing_slash=false) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/lunr.' ~ lang ~ '.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/lunr.stemmer.support.min.js', trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/lunr.stemmer.support.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/lunr.' ~ lang ~ '.min.js' , trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/lunr.' ~ lang ~ '.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- endif %} {%- endif %} @@ -106,26 +114,30 @@ {%- if preStyle == true %} {%- if config.extra.js_prestyle | default(value=true) %} - <script defer src="{{ get_url(path='js/prestyle.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/prestyle.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/prestyle.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/prestyle.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- endif %} {%- if config.extra.js_switcher | default(value=true) %} - <script defer src="{{ get_url(path='js/theme_button.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/theme_button.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/theme_button.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/theme_button.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- if config.extra.js_email_encode | default(value=true) %} - <script defer src="{{ get_url(path='js/email.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/email.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/email.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/email.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- if config.extra.js_copycode | default(value=true) %} - <script defer src="{{ get_url(path='js/codecopy.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/codecopy.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/codecopy.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/codecopy.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + {%- endif %} + + {%- if config.extra.pwa | default(value=false) %} + <script defer src="{{ get_url(path='js/sw_load.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/sw_load.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- if search_library == "tinysearch" %} - <script defer type="module" src="{{ get_url(path='js/search_tinysearch.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/search_tinysearch.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer type="module" src="{{ get_url(path='js/tinysearch.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/tinysearch.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- elif search_library == "stork" %} - <script defer type="module" src="{{ get_url(path='js/search_stork.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/search_stork.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer type="module" src="{{ get_url(path='js/search_stork.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/search_stork.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- elif config.build_search_index %} {%- set search_index_format="elasticlunr_json" -%} @@ -135,24 +147,25 @@ {%- endif %} {%- endif %} - {%- set uglyurls=config.extra.uglyurls | default(value=false) -%} + {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} + {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- if search_index_format == "elasticlunr_javascript" %}{#- Javascript index format #} - <script defer src="{{ get_url(path='js/elasticlunr.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/elasticlunr.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> - <script defer src="{{ get_url(path='search_index.' ~ lang ~ '.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='search_index.' ~ lang ~ '.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/elasticlunr.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/elasticlunr.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='search_index.' ~ lang ~ '.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='search_index.' ~ lang ~ '.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- if uglyurls %} - <script defer src="{{ get_url(path='js/searchjavaugly.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/searchjavaugly.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/searchjavaugly.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/searchjavaugly.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- else %} - <script defer src="{{ get_url(path='js/searchjava.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/searchjava.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/searchjava.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/searchjava.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- else %} - <script defer src="{{ get_url(path='js/search_elasticlunr.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/search_elasticlunr.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/search_elasticlunr.min.js' , trailing_slash=false, cachebust=true) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/search_elasticlunr.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- if lang != "en" %} - <script defer src="{{ get_url(path='js/lunr.stemmer.support.min.js', trailing_slash=false) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/lunr.stemmer.support.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> - <script defer src="{{ get_url(path='js/lunr.' ~ lang ~ '.min.js' , trailing_slash=false) | safe }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path='js/lunr.' ~ lang ~ '.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/lunr.stemmer.support.min.js', trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/lunr.stemmer.support.min.js', sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path='js/lunr.' ~ lang ~ '.min.js' , trailing_slash=false) | safe }}"{%- if integrity %} integrity="sha384-{{ get_hash(path='js/lunr.' ~ lang ~ '.min.js' , sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- endif %} @@ -167,35 +180,35 @@ {%- set katex_bundle=config.extra.katex_bundle | default(value="js/katexbundle.min.js") -%} {%- if katex_bundle %} - <script defer src="{{ get_url(path=katex_bundle , trailing_slash=false, cachebust=true) }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=katex_bundle, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path=katex_bundle , trailing_slash=false, cachebust=true) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_bundle, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- else %} {%- set katex_js=config.extra.katex_js | default(value="js/katex.min.js") -%} {%- if katex_js %}{%- if katex_js is matching("^http[s]?://") %} - <script defer src="{{ katex_js | safe }}"{%- if config.extra.integrity | default(value=true) and config.extra.katex_js_integrity %} integrity="{{ config.extra.katex_js_integrity | safe }}"{%- endif %} crossorigin="anonymous"></script> + <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 config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=katex_js, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <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]?://") %} - <script defer src="{{ mathtex_js | safe }}"{%- if config.extra.integrity | default(value=true) and config.extra.mathtex_js_integrity %} integrity="{{ config.extra.mathtex_js_integrity | safe }}"{%- endif %} crossorigin="anonymous"></script> + <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 config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=mathtex_js, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <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 %} {%- 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]?://") %} - <script defer src="{{ katex_autorender_js | safe }}"{%- if config.extra.integrity | default(value=true) and config.extra.katex_autorender_js_integrity %} integrity="{{ config.extra.katex_autorender_js_integrity | safe }}"{%- endif %} crossorigin="anonymous"></script> + <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 config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=katex_autorender_js, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <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> {%- endif %} {%- endif %} {%- set katex_options=config.extra.katex_options | default(value="js/katexoptions.js") -%} {%- if katex_options %} - <script defer src="{{ get_url(path=katex_options , trailing_slash=false, cachebust=true) }}"{%- if config.extra.integrity | default(value=true) %} integrity="sha384-{{ get_hash(path=katex_options, sha_type=384, base64=true) | safe }}"{%- endif %}></script> + <script defer src="{{ get_url(path=katex_options , trailing_slash=false, cachebust=true) }}"{%- if integrity %} integrity="sha384-{{ get_hash(path=katex_options, sha_type=384, base64=true) | safe }}"{%- endif %}></script> {%- endif %} {%- endif %} {%- endif %} diff --git a/templates/macros/macros.html b/templates/macros/macros.html index 1a033cf..000130a 100644 --- a/templates/macros/macros.html +++ b/templates/macros/macros.html @@ -1,15 +1,19 @@ {%- macro title_post(page, config) %} - <h1><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1> +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} + <h1><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1> {%- endmacro title_post %} {%- macro meta_post(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% 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 config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a> + <a href="{{ get_taxonomy_url(kind='authors', name=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 %} @@ -64,25 +68,29 @@ {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- 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 config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% 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', name=cat, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% 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 config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> + {%- 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 %} {%- macro title_index(page, config) %} - <h1>{% if config.extra.title_size_index %}<span class="{{ config.extra.title_size_index }}">{% endif %}<a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a>{% if config.extra.title_size_index %}</span>{% endif %}</h1> +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} + <h1>{% 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 }}</a>{% if config.extra.title_size_index %}</span>{% endif %}</h1> {%- endmacro title_index %} {%- macro meta_index(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% 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 config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a> + <a href="{{ get_taxonomy_url(kind='authors', name=author, lang=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 %} @@ -138,28 +146,30 @@ {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- 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 config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% 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', name=cat, lang=lang) | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% 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 config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> + {%- 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 %} {%- macro footer(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% 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> <div> {%- if page.lower %} - <a href="{{ page.lower.permalink | safe }}">‹ {{ page.lower.title | truncate(length=100) }}</a> + <a href="{{ page.lower.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">‹ {{ page.lower.title | truncate(length=100) }}</a> {%- endif %} </div> <div> {%- if page.higher %} - <a href="{{ page.higher.permalink | safe }}"> {{ page.higher.title | truncate(length=100) }} ›</a> + <a href="{{ page.higher.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}"> {{ page.higher.title | truncate(length=100) }} ›</a> {%- endif %} </div> </nav> @@ -169,6 +179,8 @@ {%- macro pagination(paginator, config)%} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- if paginator.number_pagers > 1 %} {%- if paginator.number_pagers <= 5 %} {# 5 or less pager is simple, just display all 5 #} {%- set start = 1 %} @@ -203,7 +215,7 @@ {%- 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 config.extra.uglyurls %}index.html{%- endif %}" title="First Page"> + <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 -%} @@ -217,7 +229,7 @@ {%- endif -%} {%- if paginator.previous -%} - <a class="on outp" href="{{ paginator.previous | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Previous Page"> + <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 -%} @@ -234,14 +246,14 @@ {%- if i == paginator.current_index -%} <a class="inp on cnav" href="#">{{i}}</a> {%- elif i > 1 -%} - <a class="inp on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{i}}</a> + <a class="inp on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if uglyurls %}index.html{%- endif %}">{{i}}</a> {%- else -%} - <a class="inp on" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ i }}</a> + <a class="inp on" href="{{ paginator.first | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ i }}</a> {%- endif -%} {%- endfor -%} {%- if paginator.next -%} - <a class="on outp" href="{{ paginator.next | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Next Page"> + <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 -%} @@ -255,7 +267,7 @@ {%- endif -%} {%- if paginator.next -%} - <a class="on outp" href="{{ paginator.last | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Last Page"> + <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 -%} diff --git a/templates/macros/page.html b/templates/macros/page.html index 7fd0f77..23b9e09 100644 --- a/templates/macros/page.html +++ b/templates/macros/page.html @@ -1,5 +1,7 @@ {%- macro page_listing(page, config) %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} <div class="toc-item"> - <a href="{{ page.permalink | safe}}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a> + <a href="{{ page.permalink | safe}}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> </div> {%- endmacro page_listing %} diff --git a/templates/tags/list.html b/templates/tags/list.html index a24ef09..2124b02 100644 --- a/templates/tags/list.html +++ b/templates/tags/list.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{- super() }} @@ -22,9 +24,9 @@ <p>{% for term in terms %} #<a href="#{{ term.name }}">{{ term.name }}</a><sup>{{ term.pages | length }}</sup> {% endfor %}</p> </div> {%- for term in terms %} - <h2 id="{{ term.name }}">#<a href="{{ term.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ term.name }}</a></h2> + <h2 id="{{ term.name }}">#<a href="{{ term.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ term.name }}</a></h2> {%- for page in term.pages %} - <p><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> + <p><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> {%- endfor %} {%- endfor %} </div> diff --git a/templates/tags/single.html b/templates/tags/single.html index 8984219..d21d9b0 100644 --- a/templates/tags/single.html +++ b/templates/tags/single.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{%- set uglyurls = config.extra.uglyurls | default(value=false) -%} +{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} {%- block seo %} {{- super() }} @@ -21,7 +23,7 @@ {%- for year, posts in term.pages | group_by(attribute="year") %} <h3>{{ year }}</h3> {%- for page in posts %} - <p><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> + <p><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}">{{ page.title }}</a> - <time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time></p> {%- endfor %} {%- endfor %} </div> |
