fix: replace .Site.BaseURL by recommended alternatives (#761)

This commit is contained in:
Robert Kaussow 2024-01-07 16:24:22 +01:00 committed by GitHub
parent e11f0c891c
commit eae99409b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 11 deletions

View file

@ -9,8 +9,18 @@ ci:
- http://localhost/usage/getting-started/ - http://localhost/usage/getting-started/
settings: settings:
chromeFlags: "--no-sandbox" chromeFlags: "--no-sandbox"
onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'] onlyCategories: ["performance", "accessibility", "best-practices", "seo"]
skipAudits: ["color-contrast", "uses-long-cache-ttl", "csp-xss", "bf-cache", "is-crawlable", "image-size-responsive"] skipAudits:
[
"color-contrast",
"uses-long-cache-ttl",
"csp-xss",
"bf-cache",
"is-crawlable",
"image-size-responsive",
"render-blocking-resources",
"largest-contentful-paint"
]
assert: assert:
preset: "lighthouse:no-pwa" preset: "lighthouse:no-pwa"
assertions: assertions:
@ -21,6 +31,8 @@ ci:
bf-cache: off bf-cache: off
is-crawlable: off is-crawlable: off
image-size-responsive: off image-size-responsive: off
render-blocking-resources: off
largest-contentful-paint: off
tap-targets: warn tap-targets: warn
unsized-images: warn unsized-images: warn
# FIXME: https://github.com/GoogleChrome/lighthouse/issues/11460 # FIXME: https://github.com/GoogleChrome/lighthouse/issues/11460

View file

@ -96,7 +96,7 @@ enableRobotsTXT = true
# by the 'img' shortcode. # by the 'img' shortcode.
geekdocImageLazyLoading = true geekdocImageLazyLoading = true
# (Optional, default false) Set HTMl <base> to .Site.BaseURL if enabled. It might be required # (Optional, default false) Set HTMl <base> to .Site.Home.Permalink if enabled. It might be required
# if a subdirectory is used within Hugos BaseURL. # if a subdirectory is used within Hugos BaseURL.
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base. # See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
geekdocOverwriteHTMLBase = false geekdocOverwriteHTMLBase = false
@ -221,7 +221,7 @@ params:
# by the 'img' shortcode. # by the 'img' shortcode.
geekdocImageLazyLoading: true geekdocImageLazyLoading: true
# (Optional, default false) Set HTMl <base> to .Site.BaseURL if enabled. It might be required # (Optional, default false) Set HTMl <base> to .Site.Home.Permalink if enabled. It might be required
# if a subdirectory is used within Hugos BaseURL. # if a subdirectory is used within Hugos BaseURL.
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base. # See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
geekdocOverwriteHTMLBase: false geekdocOverwriteHTMLBase: false

View file

@ -27,7 +27,7 @@
<div class="gdoc-error__line gdoc-error__title">{{ i18n "error_message_title" }}</div> <div class="gdoc-error__line gdoc-error__title">{{ i18n "error_message_title" }}</div>
<div class="gdoc-error__line gdoc-error__code">{{ i18n "error_message_code" }}</div> <div class="gdoc-error__line gdoc-error__code">{{ i18n "error_message_code" }}</div>
<div class="gdoc-error__line gdoc-error__help"> <div class="gdoc-error__line gdoc-error__help">
{{ i18n "error_message_text" .Site.BaseURL | safeHTML }} {{ i18n "error_message_text" .Site.Home.Permalink | safeHTML }}
</div> </div>
</div> </div>
</div> </div>

View file

@ -67,7 +67,7 @@
{{- end }} {{- end }}
{{- if (default false $.Site.Params.geekdocOverwriteHTMLBase) }} {{- if (default false $.Site.Params.geekdocOverwriteHTMLBase) }}
<base href="{{ .Site.BaseURL }}" /> <base href="{{ .Site.Home.Permalink }}" />
{{- end }} {{- end }}
{{ printf "<!-- %s -->" "Made with Geekdoc theme https://github.com/thegeeklab/hugo-geekdoc" | safeHTML }} {{ printf "<!-- %s -->" "Made with Geekdoc theme https://github.com/thegeeklab/hugo-geekdoc" | safeHTML }}

View file

@ -5,7 +5,7 @@
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "WebSite", "@type": "WebSite",
"name": {{ .Site.Title }}, "name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }}, "url": {{ .Site.Home.Permalink }},
{{- with partial "utils/description" . }} {{- with partial "utils/description" . }}
"description": "{{ . | plainify | htmlUnescape | chomp }}", "description": "{{ . | plainify | htmlUnescape | chomp }}",
{{- end }} {{- end }}
@ -57,7 +57,7 @@
"publisher":{ "publisher":{
"@type":"Organization", "@type":"Organization",
"name": {{ .Site.Title }}, "name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }}, "url": {{ .Site.Home.Permalink }},
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ (default "brand.svg" .Site.Params.logo) | absURL }}, "url": {{ (default "brand.svg" .Site.Params.logo) | absURL }},

View file

@ -8,7 +8,7 @@
placeholder="{{ i18n "form_placeholder_search" }}..." placeholder="{{ i18n "form_placeholder_search" }}..."
aria-label="{{ i18n "form_placeholder_search" }}" aria-label="{{ i18n "form_placeholder_search" }}"
maxlength="64" maxlength="64"
data-site-base-url="{{ .Site.BaseURL }}" data-site-base-url="{{ "" | absURL }}"
data-site-lang="{{ .Site.Language.Lang }}" data-site-lang="{{ .Site.Language.Lang }}"
/> />
<ul id="gdoc-search-results" class="gdoc-search__list"></ul> <ul id="gdoc-search-results" class="gdoc-search__list"></ul>

View file

@ -13,7 +13,7 @@
</label> </label>
{{ end }} {{ end }}
<div> <div>
<a class="gdoc-brand gdoc-header__link" href="{{ .Root.Site.BaseURL }}"> <a class="gdoc-brand gdoc-header__link" href="{{ .Root.Site.Home.Permalink }}">
<span class="flex align-center"> <span class="flex align-center">
<img <img
class="gdoc-brand__img" class="gdoc-brand__img"
@ -47,7 +47,7 @@
</span> </span>
<span class="gdoc-menu-header__home"> <span class="gdoc-menu-header__home">
<a href="{{ .Root.Site.BaseURL }}" class="gdoc-header__link"> <a href="{{ .Root.Site.Home.Permalink }}" class="gdoc-header__link">
<svg class="gdoc-icon gdoc_home"> <svg class="gdoc-icon gdoc_home">
<title>{{ i18n "button_homepage" }}</title> <title>{{ i18n "button_homepage" }}</title>
<use xlink:href="#gdoc_home"></use> <use xlink:href="#gdoc_home"></use>