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/
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

View File

@ -96,7 +96,7 @@ enableRobotsTXT = true
# by the 'img' shortcode.
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.
# 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 <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.
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
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__code">{{ i18n "error_message_code" }}</div>
<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>

View File

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

View File

@ -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 }},

View File

@ -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 }}"
/>
<ul id="gdoc-search-results" class="gdoc-search__list"></ul>

View File

@ -13,7 +13,7 @@
</label>
{{ end }}
<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">
<img
class="gdoc-brand__img"
@ -47,7 +47,7 @@
</span>
<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">
<title>{{ i18n "button_homepage" }}</title>
<use xlink:href="#gdoc_home"></use>