From cf9b479335f450d01dd53541f867da164dd4b6c8 Mon Sep 17 00:00:00 2001 From: paspo Date: Sun, 27 Oct 2024 21:48:54 +0000 Subject: [PATCH] SRI (Subresource Integrity) (#280) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit è la cosa per cui i CSS/JS richiamati dall'html hanno un tag con l'hash fixes #283 Reviewed-on: https://git.libreschool.org/BgLUG/bglug.it/pulls/280 Co-authored-by: paspo Co-committed-by: paspo --- assets/js/taglist.js | 5 +++++ config.yml | 10 +++++++--- data/en/homepage.yml | 2 +- data/globalheader.yml | 2 +- data/it/homepage.yml | 2 +- layouts/partials/custom_head.html | 2 +- layouts/partials/head/head.html | 9 +++++++-- layouts/partials/sidebar/taglist.html | 14 +++++++------- static/{ => images}/homepage_banner.webp | Bin static/{ => images}/logo.svg | 0 static/{ => images}/logo_tondo.svg | 0 11 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 assets/js/taglist.js rename static/{ => images}/homepage_banner.webp (100%) rename static/{ => images}/logo.svg (100%) rename static/{ => images}/logo_tondo.svg (100%) diff --git a/assets/js/taglist.js b/assets/js/taglist.js new file mode 100644 index 00000000..4bcce0db --- /dev/null +++ b/assets/js/taglist.js @@ -0,0 +1,5 @@ +function show_all_tags(e) { + $(".tags-sidebar li").css("display","inline-block"); + $(e).css("display","none"); + return false; + } diff --git a/config.yml b/config.yml index 26d1d9de..24385938 100644 --- a/config.yml +++ b/config.yml @@ -3,7 +3,7 @@ baseURL: https://bglug.it languageCode: it-IT title: BgLUG subtitle: Bergamo Linux Users Group -logo: logo_tondo.svg +logo: images/logo_tondo.svg author: BgLUG theme: hugo-arcana copyright: 2024 © Bergamo Linux Users Group @@ -259,8 +259,12 @@ imaging: module: mounts: - source: static/.well-known - target: static/.well-known + - source: static/.well-known + target: static/.well-known + - source: static/images + target: static/images + - source: static/favicon + target: static/favicon pagination: pagerSize: 20 diff --git a/data/en/homepage.yml b/data/en/homepage.yml index ff448fcf..4074f763 100644 --- a/data/en/homepage.yml +++ b/data/en/homepage.yml @@ -1,7 +1,7 @@ --- banner: enable: true - image: homepage_banner.webp + image: images/homepage_banner.webp contents: "What is Bergamo Linux Users Group?" button: contents: "Learn more..." diff --git a/data/globalheader.yml b/data/globalheader.yml index 0dbbb7b0..8fca9843 100644 --- a/data/globalheader.yml +++ b/data/globalheader.yml @@ -1,5 +1,5 @@ --- title: "BgLUG --- Bergamo Linux Users Group" -image: logo.svg +image: images/logo.svg image_alt: Logo BgLUG image_width: 300 diff --git a/data/it/homepage.yml b/data/it/homepage.yml index fe976091..48d6565f 100644 --- a/data/it/homepage.yml +++ b/data/it/homepage.yml @@ -1,7 +1,7 @@ --- banner: enable: true - image: homepage_banner.webp + image: images/homepage_banner.webp contents: "Cos'è il Bergamo Linux Users Group?" button: contents: "Scopri di più..." diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html index 89f478d8..33fe8141 100644 --- a/layouts/partials/custom_head.html +++ b/layouts/partials/custom_head.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index bfaa21cf..8e0917fa 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -3,7 +3,12 @@ {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }} - -{{- partial "analytics/google-tag-manager/head.html" . -}} +{{ if hugo.IsDevelopment }} + +{{ else }} + {{ with $style | minify | fingerprint }} + + {{ end }} +{{ end }} {{- partial "head/custom.html" . -}} {{- template "_internal/twitter_cards.html" . -}} diff --git a/layouts/partials/sidebar/taglist.html b/layouts/partials/sidebar/taglist.html index 9655d386..b8112ae0 100644 --- a/layouts/partials/sidebar/taglist.html +++ b/layouts/partials/sidebar/taglist.html @@ -1,12 +1,12 @@
- + {{ $js := resources.Get "js/taglist.js" }} + {{ with $js | minify | fingerprint }} + + {{ end }}

Tags

    diff --git a/static/homepage_banner.webp b/static/images/homepage_banner.webp similarity index 100% rename from static/homepage_banner.webp rename to static/images/homepage_banner.webp diff --git a/static/logo.svg b/static/images/logo.svg similarity index 100% rename from static/logo.svg rename to static/images/logo.svg diff --git a/static/logo_tondo.svg b/static/images/logo_tondo.svg similarity index 100% rename from static/logo_tondo.svg rename to static/images/logo_tondo.svg