From a961bc284bb130e44468c07aaaa028652c151e08 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2023 19:21:12 +0200 Subject: Squashed 'themes/bear/' changes from fe37fcf..d10630d d10630d Hash inline style in CSP f51202d Allow end-user to disable CSP header meta tags without editing theme 093ac10 Add form-action and base-uri CSPs 4c9ac0a Update base_url eed984f Merge dark/light screenshots into one 099acbd Add "deploy to netlify" button 0800ba2 Update demo URL 9a344d8 Add meta description 241f290 Remove ignored CSP content 53d198f Move demo site to netlify 3423985 Add netlify status badge to readme edfec31 Configure headers for netlify a1bcb91 Add netlify.toml d69e95a Add content-security-policy header-equivalent meta tag 1706ade Linkify demo URL 141c10c Merge pull request 'Update 'theme.toml'' (#1) from jakeg/zola-bearblog:main into main 6b275f6 Update 'theme.toml' REVERT: fe37fcf Merge branch 'main' into microformats2 REVERT: 40881d1 Merge branch 'main' into microformats2 REVERT: 2ca8f6c Merge branch 'main' into microformats2 REVERT: dad7895 Merge branch 'main' into microformats2 REVERT: cdd1069 Move header/footer/main elements into child templates git-subtree-dir: themes/bear git-subtree-split: d10630da50a2b0e005ef0499190cc5cc898f0b06 --- README.md | 21 +++--- config.toml | 5 +- netlify.toml | 25 +++++++ screenshot-dark.png | Bin 319272 -> 0 bytes screenshot.png | Bin 317002 -> 262700 bytes templates/base.html | 7 +- templates/security_tags.html | 2 + templates/seo_tags.html | 1 + templates/style.css.html | 169 ++++++++++++++++++++++++++++++++++++++++++ templates/style.html | 172 ------------------------------------------- theme.toml | 5 +- 11 files changed, 221 insertions(+), 186 deletions(-) create mode 100644 netlify.toml delete mode 100644 screenshot-dark.png create mode 100644 templates/security_tags.html create mode 100644 templates/style.css.html delete mode 100644 templates/style.html diff --git a/README.md b/README.md index 5396a5b..db77233 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,18 @@ # Zola ʕ•ᴥ•ʔ Bear Blog +[![Netlify Status](https://api.netlify.com/api/v1/badges/121b53ce-c913-4604-9179-eb3cca31cd2c/deploy-status)](https://app.netlify.com/sites/zola-bearblog/deploys) + 🧸 A [Zola](https://www.getzola.org/)-theme based on [Bear Blog](https://bearblog.dev). > Free, no-nonsense, super-fast blogging. ## Demo -For a current & working demo of this theme, please check out https://alanpearce.codeberg.page/zola-bearblog/ 🎯. - -## Screenshots +For a current & working demo of this theme, please check out 🎯. -⬜️ [Light][light-screenshot] -![light mode screenshot][light-screenshot] +## Screenshot -⬛️ [Dark][dark-screenshot] -![dark mode screenshot][dark-screenshot] +![Screenshot][screenshot] When the user's browser is running »dark mode«, the dark color scheme will be used automatically. The default is the light/white color scheme. Check out the [`style.html`](https://codeberg.org/alanpearce/zola-bearblog/src/branch/main/templates/style.html)-file for the implementation. @@ -30,6 +28,12 @@ Then, adjust the `config.toml` as detailed below. For more information, read the official [setup guide][zola-setup-guide] of Zola. +Alternatively, you can quickly deploy a copy of the theme site to Netlify using this button: + +[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://gitlab.com/alanpearce/zola-bearblog) + +(Note that this method makes it harder to keep up-to-date with theme updates, which might be necessary for newer versions of Zola.) + ## Adjust configuration / config.toml Please check out the included [config.toml](https://codeberg.org/alanpearce/zola-bearblog/src/branch/main/config.toml) @@ -76,5 +80,4 @@ A special thank you goes out to [Herman](https://herman.bearblog.dev), for creat [MIT License](http://en.wikipedia.org/wiki/MIT_License) © [Alan Pearce](https://www.alanpearce.eu/) [zola-setup-guide]: https://www.getzola.org/documentation/getting-started/installation/ -[light-screenshot]: https://codeberg.org/alanpearce/zola-bearblog/raw/branch/main/screenshot.png -[dark-screenshot]: https://codeberg.org/alanpearce/zola-bearblog/raw/branch/main/screenshot-dark.png +[screenshot]: https://codeberg.org/alanpearce/zola-bearblog/raw/branch/main/screenshot.png diff --git a/config.toml b/config.toml index ca8d27a..78e9f9a 100644 --- a/config.toml +++ b/config.toml @@ -1,6 +1,6 @@ title = "Zola ʕ•ᴥ•ʔ Bear Blog" -base_url = "https://alanpearce.codeberg.page/zola-bearblog" -description = "" +base_url = "https://zola-bearblog.netlify.app/" +description = "A Zola-theme based on Bear Blog." # Whether to automatically compile all Sass files in the sass directory compile_sass = false @@ -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/netlify.toml b/netlify.toml new file mode 100644 index 0000000..6be8468 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,25 @@ +[build] +publish = "public" +command = "zola build" + +[build.environment] +# Set the version name that you want to use and Netlify will automatically use it. +ZOLA_VERSION = "0.17.2" + +# The magic for deploying previews of branches. +# We need to override the base url with whatever url Netlify assigns to our +# preview site. We do this using the Netlify environment variable +# `$DEPLOY_PRIME_URL`. + +[context.deploy-preview] +command = "zola build --base-url $DEPLOY_PRIME_URL" + +[[headers]] + for = "/*" + [headers.values] + X-Frame-Options = "DENY" + X-Content-Type-Options = "nosniff" + 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 'sha256-2Sbht7dvdhJX00j84akXy9AejYUf6sOM3OpwMxNiDXQ='; form-action 'none'; base-uri 'self'; frame-ancestors 'none'" diff --git a/screenshot-dark.png b/screenshot-dark.png deleted file mode 100644 index 266f883..0000000 Binary files a/screenshot-dark.png and /dev/null differ diff --git a/screenshot.png b/screenshot.png index 4013a5c..273266a 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/templates/base.html b/templates/base.html index 4ba8442..ee206b3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,9 @@ + {%- if config.webserver_sends_csp_headers %} + {%- include "security_tags.html" ignore missing %} + {%- endif %} {% include "favicon.html" ignore missing -%} @@ -12,7 +15,9 @@ {%- endblock -%} {%- endif %} - {% include "style.html" ignore missing -%} + {% include "custom_head.html" ignore missing -%} diff --git a/templates/security_tags.html b/templates/security_tags.html new file mode 100644 index 0000000..0f922ea --- /dev/null +++ b/templates/security_tags.html @@ -0,0 +1,2 @@ + + 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 @@ + 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 @@ - diff --git a/theme.toml b/theme.toml index ed137c8..902c8ec 100644 --- a/theme.toml +++ b/theme.toml @@ -1,11 +1,11 @@ name = "Bear" description = "Bear blog theme" license = "MIT" -homepage = "https://codeberg.org/alanpearce/zola/bearblog" +homepage = "https://codeberg.org/alanpearce/zola-bearblog" # The minimum version of Zola required min_version = "0.4.0" # An optional live demo URL -demo = "https://alanpearce.codeberg.page/zola-bearblog" +demo = "https://zola-bearblog.netlify.app/" # Any variable there can be overridden in the end user `config.toml` # You don't need to prefix variables by the theme name but as this will @@ -13,6 +13,7 @@ demo = "https://alanpearce.codeberg.page/zola-bearblog" # 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