From eae99409b713c95d929d4c5653d229e3a8a56c10 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 7 Jan 2024 16:24:22 +0100 Subject: [PATCH] fix: replace `.Site.BaseURL` by recommended alternatives (#761) --- .lighthouserc.yml | 16 ++++++++++++++-- exampleSite/content/en/usage/configuration.md | 4 ++-- layouts/404.html | 2 +- layouts/partials/head/others.html | 2 +- layouts/partials/microformats/schema.html | 4 ++-- layouts/partials/search.html | 2 +- layouts/partials/site-header.html | 4 ++-- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.lighthouserc.yml b/.lighthouserc.yml index 8076332..3905309 100644 --- a/.lighthouserc.yml +++ b/.lighthouserc.yml @@ -9,8 +9,18 @@ ci: - http://localhost/usage/getting-started/ settings: chromeFlags: "--no-sandbox" - onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'] - skipAudits: ["color-contrast", "uses-long-cache-ttl", "csp-xss", "bf-cache", "is-crawlable", "image-size-responsive"] + onlyCategories: ["performance", "accessibility", "best-practices", "seo"] + skipAudits: + [ + "color-contrast", + "uses-long-cache-ttl", + "csp-xss", + "bf-cache", + "is-crawlable", + "image-size-responsive", + "render-blocking-resources", + "largest-contentful-paint" + ] assert: preset: "lighthouse:no-pwa" assertions: @@ -21,6 +31,8 @@ ci: bf-cache: off is-crawlable: off image-size-responsive: off + render-blocking-resources: off + largest-contentful-paint: off tap-targets: warn unsized-images: warn # FIXME: https://github.com/GoogleChrome/lighthouse/issues/11460 diff --git a/exampleSite/content/en/usage/configuration.md b/exampleSite/content/en/usage/configuration.md index 52a85ce..c4dfd84 100644 --- a/exampleSite/content/en/usage/configuration.md +++ b/exampleSite/content/en/usage/configuration.md @@ -96,7 +96,7 @@ enableRobotsTXT = true # by the 'img' shortcode. geekdocImageLazyLoading = true - # (Optional, default false) Set HTMl to .Site.BaseURL if enabled. It might be required + # (Optional, default false) Set HTMl to .Site.Home.Permalink if enabled. It might be required # if a subdirectory is used within Hugos BaseURL. # See https://developer.mozilla.org/de/docs/Web/HTML/Element/base. geekdocOverwriteHTMLBase = false @@ -221,7 +221,7 @@ params: # by the 'img' shortcode. geekdocImageLazyLoading: true - # (Optional, default false) Set HTMl to .Site.BaseURL if enabled. It might be required + # (Optional, default false) Set HTMl to .Site.Home.Permalink if enabled. It might be required # if a subdirectory is used within Hugos BaseURL. # See https://developer.mozilla.org/de/docs/Web/HTML/Element/base. geekdocOverwriteHTMLBase: false diff --git a/layouts/404.html b/layouts/404.html index f8a61bb..ee7ba2d 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -27,7 +27,7 @@
{{ i18n "error_message_title" }}
{{ i18n "error_message_code" }}
- {{ i18n "error_message_text" .Site.BaseURL | safeHTML }} + {{ i18n "error_message_text" .Site.Home.Permalink | safeHTML }}
diff --git a/layouts/partials/head/others.html b/layouts/partials/head/others.html index 537c2ff..06f346d 100644 --- a/layouts/partials/head/others.html +++ b/layouts/partials/head/others.html @@ -67,7 +67,7 @@ {{- end }} {{- if (default false $.Site.Params.geekdocOverwriteHTMLBase) }} - + {{- end }} {{ printf "" "Made with Geekdoc theme https://github.com/thegeeklab/hugo-geekdoc" | safeHTML }} diff --git a/layouts/partials/microformats/schema.html b/layouts/partials/microformats/schema.html index e4a71eb..4204b0d 100644 --- a/layouts/partials/microformats/schema.html +++ b/layouts/partials/microformats/schema.html @@ -5,7 +5,7 @@ "@context": "http://schema.org", "@type": "WebSite", "name": {{ .Site.Title }}, - "url": {{ .Site.BaseURL }}, + "url": {{ .Site.Home.Permalink }}, {{- with partial "utils/description" . }} "description": "{{ . | plainify | htmlUnescape | chomp }}", {{- end }} @@ -57,7 +57,7 @@ "publisher":{ "@type":"Organization", "name": {{ .Site.Title }}, - "url": {{ .Site.BaseURL }}, + "url": {{ .Site.Home.Permalink }}, "logo": { "@type": "ImageObject", "url": {{ (default "brand.svg" .Site.Params.logo) | absURL }}, diff --git a/layouts/partials/search.html b/layouts/partials/search.html index 62b2e6f..bd25775 100644 --- a/layouts/partials/search.html +++ b/layouts/partials/search.html @@ -8,7 +8,7 @@ placeholder="{{ i18n "form_placeholder_search" }}..." aria-label="{{ i18n "form_placeholder_search" }}" maxlength="64" - data-site-base-url="{{ .Site.BaseURL }}" + data-site-base-url="{{ "" | absURL }}" data-site-lang="{{ .Site.Language.Lang }}" /> diff --git a/layouts/partials/site-header.html b/layouts/partials/site-header.html index 022c10a..07aabf1 100644 --- a/layouts/partials/site-header.html +++ b/layouts/partials/site-header.html @@ -13,7 +13,7 @@ {{ end }}
- + - + {{ i18n "button_homepage" }}