Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .lighthouserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/en/usage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head/others.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions layouts/partials/microformats/schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }},
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/site-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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>
Expand Down