From 5e55301cc2c91a5f0e99000bfe4d7ec262ee78c1 Mon Sep 17 00:00:00 2001
From: Jieiku
Date: Fri, 8 Sep 2023 15:08:39 -0700
Subject: Refactor package.json
---
templates/404.html | 6 ++-
templates/archive.html | 6 ++-
templates/base.html | 17 ++++----
templates/categories/list.html | 6 ++-
templates/categories/single.html | 4 +-
templates/index.html | 4 +-
templates/macros/head.html | 87 +++++++++++++++++++++++-----------------
templates/macros/macros.html | 44 ++++++++++++--------
templates/macros/page.html | 4 +-
templates/tags/list.html | 6 ++-
templates/tags/single.html | 4 +-
11 files changed, 115 insertions(+), 73 deletions(-)
(limited to 'templates')
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 @@
404 :(
{#- Default English message #}
-
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 %}go to homepage .
+
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 %}go to homepage .
{# Iterate through each language and display the localised 404 message #}
{%- for lcode, language in config.languages -%}
{%- if lcode != config.default_language -%}
-
{{ trans(key="404_not_found", lang=lcode) }}. {% if config.build_search_index %}{{ trans(key="404_try_search", lang=lcode) }}{% endif %} {{ trans(key="404_go_home", lang=lcode) }} .
+
{{ trans(key="404_not_found", lang=lcode) }}. {% if config.build_search_index %}{{ trans(key="404_try_search", lang=lcode) }}{% endif %} {{ trans(key="404_go_home", lang=lcode) }} .
{%- endif -%}
{%- endfor -%}
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 %}
- {{ post.title }} {%- if not hide_section_dates %} - {{ post.date | date(format="%F") }} {%- endif %}
+ {{ post.title }} {%- if not hide_section_dates %} - {{ post.date | date(format="%F") }} {%- endif %}
{%- 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 %}
- {{ post.title }} {%- if not hide_section_dates %} - {{ post.date | date(format="%F") }} {%- endif %}
+ {{ post.title }} {%- if not hide_section_dates %} - {{ post.date | date(format="%F") }} {%- endif %}
{%- 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 %}
@@ -27,7 +29,6 @@
{{- macros_head::security(config=config) }}
{{- macros_head::favicons(config=config) }}
- {{- macros_head::pwa(config=config) }}
{%- block comments_init %}
{%- endblock comments_init %}
@@ -38,18 +39,18 @@
@@ -57,7 +58,7 @@
{%- if config.extra.menu or js_switcher %}
{%- if config.extra.menu %}
{%- for i in config.extra.menu -%}
-
+
{%- if lang != config.default_language %} {{ trans(key=i.name | safe, lang=lang) }} {% else %} {{ i.name | safe }} {% endif -%}
{%- endfor -%}
@@ -74,9 +75,9 @@
{%- for lcode,flag in config.extra.flag -%}
{%- if lang != lcode -%}
{%- if lcode == config.default_language -%}
-
{{ flag }}
+
{{ flag }}
{%- else -%}
-
{{ flag }}
+
{{ flag }}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
@@ -145,7 +146,7 @@
{%- else %}
{%- set furl=get_url(path=i.url, trailing_slash=i.slash) %}
{%- endif %}
-
+
{%- endfor %}
{%- 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 @@
{% for term in terms %} [{{ term.name }} ]{{ term.pages | length }} {% endfor %}
{%- for term in terms %}
- {{ term.name }}
+ {{ term.name }}
{%- for page in term.pages %}
- {{ page.title }} - {{ page.date | date(format="%F") }}
+ {{ page.title }} - {{ page.date | date(format="%F") }}
{%- endfor %}
{%- endfor %}
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") %}
{{ year }}
{%- for page in posts %}
- {{ page.title }} - {{ page.date | date(format="%F") }}
+ {{ page.title }} - {{ page.date | date(format="%F") }}
{%- endfor %}
{%- endfor %}
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 %}
- ...more
+ ...more
{%- 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 %}
-
- {%- endif %}
-{%- endmacro %}
-
-{#- Service Worker for PWA #}
-{%- macro pwa(config) %}
- {%- if config.extra.pwa | default(value=false) %}
-
+
{%- 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]?://") %}
-
+
{%- else %}
-
+
{%- 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 %}
-
+ {%- if config.extra.pwa | default(value=false) %}
+
+ {%- else %}
+
+ {%- endif %}
+
+ {%- else %}
+ {%- if config.extra.pwa | default(value=false) %}
+
{%- else %}
-
+
+ {%- endif %}
{%- endif %}
{%- if config.build_search_index %}
{%- if search_library == "elasticlunr" %}
{%- if lang != "en" %}
-
-
+
+
{%- endif %}
{%- endif %}
{%- endif %}
@@ -106,26 +114,30 @@
{%- if preStyle == true %}
{%- if config.extra.js_prestyle | default(value=true) %}
-
+
{%- endif %}
{%- endif %}
{%- if config.extra.js_switcher | default(value=true) %}
-
+
{%- endif %}
{%- if config.extra.js_email_encode | default(value=true) %}
-
+
{%- endif %}
{%- if config.extra.js_copycode | default(value=true) %}
-
+
+ {%- endif %}
+
+ {%- if config.extra.pwa | default(value=false) %}
+
{%- endif %}
{%- if search_library == "tinysearch" %}
-
+
{%- elif search_library == "stork" %}
-
+
{%- 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 #}
-
-
+
+
{%- if uglyurls %}
-
+
{%- else %}
-
+
{%- endif %}
{%- else %}
-
+
{%- endif %}
{%- if lang != "en" %}
-
-
+
+
{%- endif %}
{%- endif %}
@@ -167,35 +180,35 @@
{%- set katex_bundle=config.extra.katex_bundle | default(value="js/katexbundle.min.js") -%}
{%- if katex_bundle %}
-
+
{%- else %}
{%- set katex_js=config.extra.katex_js | default(value="js/katex.min.js") -%}
{%- if katex_js %}{%- if katex_js is matching("^http[s]?://") %}
-
+
{%- else %}
-
+
{%- 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]?://") %}
-
+
{%- else %}
-
+
{%- 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]?://") %}
-
+
{%- else %}
-
+
{%- endif %}
{%- endif %}
{%- set katex_options=config.extra.katex_options | default(value="js/katexoptions.js") -%}
{%- if katex_options %}
-
+
{%- 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) %}
- {{ page.title }}
+{%- set uglyurls = config.extra.uglyurls | default(value=false) -%}
+{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %}
+ {{ page.title }}
{%- endmacro title_post %}
{%- macro meta_post(page, config) %}
+{%- set uglyurls = config.extra.uglyurls | default(value=false) -%}
+{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %}
+ {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %}
{%- endmacro meta_post %}
{%- macro title_index(page, config) %}
- {% if config.extra.title_size_index %}{% endif %}
+{%- set uglyurls = config.extra.uglyurls | default(value=false) -%}
+{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %}
+ {% if config.extra.title_size_index %}{% endif %}
{%- endmacro title_index %}
{%- macro meta_index(page, config) %}
+{%- set uglyurls = config.extra.uglyurls | default(value=false) -%}
+{%- if config.extra.offline %}{% set uglyurls = true %}{% endif %}
+ {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %}
{%- 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 %}
@@ -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 -%}
-
+
{%- if icon_first -%}
{%- else -%}«
{%- endif -%}
@@ -217,7 +229,7 @@
{%- endif -%}
{%- if paginator.previous -%}
-
+
{%- if icon_prev -%}
{%- else -%}‹
{%- endif -%}
@@ -234,14 +246,14 @@
{%- if i == paginator.current_index -%}
{{i}}
{%- elif i > 1 -%}
- {{i}}
+ {{i}}
{%- else -%}
- {{ i }}
+ {{ i }}
{%- endif -%}
{%- endfor -%}
{%- if paginator.next -%}
-
+
{%- if icon_next -%}
{%- else -%}›
{%- endif -%}
@@ -255,7 +267,7 @@
{%- endif -%}
{%- if paginator.next -%}
-
+
{%- if icon_last -%}
{%- 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 %}
{%- 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 @@
{% for term in terms %} #{{ term.name }} {{ term.pages | length }} {% endfor %}
{%- for term in terms %}
- #{{ term.name }}
+ #{{ term.name }}
{%- for page in term.pages %}
- {{ page.title }} - {{ page.date | date(format="%F") }}
+ {{ page.title }} - {{ page.date | date(format="%F") }}
{%- endfor %}
{%- endfor %}
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") %}
{{ year }}
{%- for page in posts %}
- {{ page.title }} - {{ page.date | date(format="%F") }}
+ {{ page.title }} - {{ page.date | date(format="%F") }}
{%- endfor %}
{%- endfor %}
--
cgit v1.3.1