From d69e95a01c254ed616b0c4e5a1f8bfdcec7b00fe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Sep 2023 10:38:26 +0200 Subject: Add content-security-policy header-equivalent meta tag --- templates/base.html | 1 + templates/security_tags.html | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 templates/security_tags.html (limited to 'templates') diff --git a/templates/base.html b/templates/base.html index 4ba8442..02fdfe6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,7 @@ + {% include "security_tags.html" ignore missing %} {% include "favicon.html" ignore missing -%} diff --git a/templates/security_tags.html b/templates/security_tags.html new file mode 100644 index 0000000..721d511 --- /dev/null +++ b/templates/security_tags.html @@ -0,0 +1,2 @@ + + -- cgit 1.4.1 From 241f290f697a1301c6173d41fb9c6b45ec203287 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Sep 2023 18:51:39 +0200 Subject: Remove ignored CSP content --- templates/security_tags.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/security_tags.html b/templates/security_tags.html index 721d511..0f922ea 100644 --- a/templates/security_tags.html +++ b/templates/security_tags.html @@ -1,2 +1,2 @@ - + -- cgit 1.4.1 From 9a344d88944a08a96e9681fd399d9b2f25eac56c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Sep 2023 18:54:22 +0200 Subject: Add meta description --- config.toml | 2 +- templates/seo_tags.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/config.toml b/config.toml index ca8d27a..9b94cd6 100644 --- a/config.toml +++ b/config.toml @@ -1,6 +1,6 @@ title = "Zola ʕ•ᴥ•ʔ Bear Blog" base_url = "https://alanpearce.codeberg.page/zola-bearblog" -description = "" +description = "A Zola-theme based on Bear Blog." # Whether to automatically compile all Sass files in the sass directory compile_sass = false diff --git a/templates/seo_tags.html b/templates/seo_tags.html index 797569a..4eb2bc8 100644 --- a/templates/seo_tags.html +++ b/templates/seo_tags.html @@ -1 +1,2 @@ + -- cgit 1.4.1 From f51202d961e6d2337a96ef3552c4efced1fe2beb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2023 19:10:40 +0200 Subject: Allow end-user to disable CSP header meta tags without editing theme --- config.toml | 1 + templates/base.html | 8 ++++++-- theme.toml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/config.toml b/config.toml index d2a8833..78e9f9a 100644 --- a/config.toml +++ b/config.toml @@ -20,6 +20,7 @@ highlight_code = true [extra] date_format="%d %b, %Y" +webserver_sends_csp_headers=true [[extra.main_menu]] name = "Bear" diff --git a/templates/base.html b/templates/base.html index 02fdfe6..ee206b3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,7 +1,9 @@ - {% include "security_tags.html" ignore missing %} + {%- if config.webserver_sends_csp_headers %} + {%- include "security_tags.html" ignore missing %} + {%- endif %} {% include "favicon.html" ignore missing -%} @@ -13,7 +15,9 @@ {%- endblock -%} {%- endif %} - {% include "style.html" ignore missing -%} + {% include "custom_head.html" ignore missing -%} diff --git a/theme.toml b/theme.toml index 1bba50d..902c8ec 100644 --- a/theme.toml +++ b/theme.toml @@ -13,6 +13,7 @@ demo = "https://zola-bearblog.netlify.app/" # Use snake_casing to be consistent with the rest of Zola [extra] date_format="%d %b, %Y" +webserver_sends_csp_headers=false [author] name = "Alan Pearce" -- cgit 1.4.1 From d10630da50a2b0e005ef0499190cc5cc898f0b06 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2023 19:11:07 +0200 Subject: Hash inline style in CSP openssl dgst -sha256 -binary < templates/style.html | openssl enc -base64 2Sbht7dvdhJX00j84akXy9AejYUf6sOM3OpwMxNiDXQ= --- netlify.toml | 2 +- templates/style.css.html | 169 ++++++++++++++++++++++++++++++++++++++++++++++ templates/style.html | 172 ----------------------------------------------- 3 files changed, 170 insertions(+), 173 deletions(-) create mode 100644 templates/style.css.html delete mode 100644 templates/style.html (limited to 'templates') diff --git a/netlify.toml b/netlify.toml index b75399f..6be8468 100644 --- a/netlify.toml +++ b/netlify.toml @@ -22,4 +22,4 @@ command = "zola build --base-url $DEPLOY_PRIME_URL" X-XSS-Protection = "1; mode=block" Referrer-Policy = "strict-origin-when-cross-origin" Strict-Transport-Security = "max-age=63072000; includeSubdomains" - Content-Security-Policy = "default-src 'none'; img-src 'self'; object-src 'none'; script-src 'none'; style-src 'unsafe-inline'; form-action 'none'; base-uri 'self'; frame-ancestors 'none'" + Content-Security-Policy = "default-src 'none'; img-src 'self'; object-src 'none'; script-src 'none'; style-src 'sha256-2Sbht7dvdhJX00j84akXy9AejYUf6sOM3OpwMxNiDXQ='; form-action 'none'; base-uri 'self'; frame-ancestors 'none'" diff --git a/templates/style.css.html b/templates/style.css.html new file mode 100644 index 0000000..00b4131 --- /dev/null +++ b/templates/style.css.html @@ -0,0 +1,169 @@ + body { + font-family: Verdana, sans-serif; + margin: auto; + padding: 20px; + max-width: 720px; + text-align: left; + background-color: #fff; + word-wrap: break-word; + overflow-wrap: break-word; + line-height: 1.5; + color: #444; + } + + h1, + h2, + h3, + h4, + h5, + h6, + strong, + b { + color: #222; + } + + a { + color: #3273dc; + } + + .title { + text-decoration: none; + border: 0; + } + + .title span { + font-weight: 400; + } + + nav a { + margin-right: 10px; + } + + textarea { + width: 100%; + font-size: 1rem; + } + + input { + font-size: 1rem; + } + + main,article { + line-height: 1.6; + } + + table { + width: 100%; + } + + img { + max-width: 100%; + } + + code { + padding: 2px 5px; + background-color: #f2f2f2; + } + + pre code { + color: #222; + display: block; + padding: 20px; + white-space: pre-wrap; + font-size: 0.875rem; + overflow-x: auto; + } + + div.highlight pre { + background-color: initial; + color: initial; + } + + div.highlight code { + background-color: unset; + color: unset; + } + + blockquote { + border-left: 1px solid #999; + color: #222; + padding-left: 20px; + font-style: italic; + } + + footer { + padding: 25px; + text-align: center; + } + + .helptext { + color: #777; + font-size: small; + } + + .errorlist { + color: #eba613; + font-size: small; + } + + /* blog posts */ + ul.blog-posts { + list-style-type: none; + padding: unset; + } + + ul.blog-posts li { + display: flex; + } + + ul.blog-posts li span { + flex: 0 0 130px; + } + + ul.blog-posts li a:visited { + color: #8b6fcb; + } + + @media (prefers-color-scheme: dark) { + body { + background-color: #333; + color: #ddd; + } + + h1, + h2, + h3, + h4, + h5, + h6, + strong, + b { + color: #eee; + } + + a { + color: #8cc2dd; + } + + code { + background-color: #777; + } + + pre code { + color: #ddd; + } + + blockquote { + color: #ccc; + } + + textarea, + input { + background-color: #252525; + color: #ddd; + } + + .helptext { + color: #aaa; + } + } diff --git a/templates/style.html b/templates/style.html deleted file mode 100644 index 4744695..0000000 --- a/templates/style.html +++ /dev/null @@ -1,172 +0,0 @@ - -- cgit 1.4.1 From f9a560a45d98436c270db6f226f26ccde5dd8844 Mon Sep 17 00:00:00 2001 From: g4m4 Date: Mon, 29 Jan 2024 09:45:17 +0100 Subject: [TEMPLATES] Use the localised version of get_url so multilingual sites can be setup --- templates/nav.html | 2 +- templates/section.html | 2 +- templates/taxonomy_single.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'templates') diff --git a/templates/nav.html b/templates/nav.html index e006ab1..e18fda2 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -4,7 +4,7 @@ {%- if item.url is matching("https?://") %} {{ item.name }} {%- else %} - {{ item.name }} + {{ item.name }} {%- endif %} {%- endfor %} {%- endif -%} diff --git a/templates/section.html b/templates/section.html index e596ffb..b9eb680 100644 --- a/templates/section.html +++ b/templates/section.html @@ -5,7 +5,7 @@ {%- if taxonomy.term %}

Filtering for "{{ section.title }}"

- Remove filter + Remove filter {%- endif %}