diff --git a/assets/scss/_core/_font.scss b/assets/scss/_core/_font.scss index deb4df7..b9bd1fa 100644 --- a/assets/scss/_core/_font.scss +++ b/assets/scss/_core/_font.scss @@ -1,8 +1,16 @@ @font-face { font-family: 'Geist'; src: - url('/lib/fonts/GeistVF.woff2') format('woff2 supports variations'), - url('/lib/fonts/GeistVF.woff2') format('woff2-variations'); + url('{{- "lib/fonts/GeistVF.woff2" | absURL -}}') format('woff2 supports variations'), + url('{{- "lib/fonts/GeistVF.woff2" | absURL -}}') format('woff2-variations'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'FW'; + src: url('/lib/fonts/fw.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; diff --git a/assets/ts/resources.ts b/assets/ts/resources.ts index d3c5509..aabeac6 100644 --- a/assets/ts/resources.ts +++ b/assets/ts/resources.ts @@ -14,8 +14,16 @@ export async function getImageJSON(): Promise { if (document.title.split(' | ')[0] === '404') { return [] // no images on 404 page } + + const ogUrlMetaTag = document.querySelector( + 'meta[property="og:url"]' + ) as HTMLMetaElement | null + const indexJsonUrl = ogUrlMetaTag?.content + ? new URL('index.json', ogUrlMetaTag.content).href + : new URL('index.json', window.location.href).href + try { - const response = await fetch(`${window.location.href}index.json`, { + const response = await fetch(indexJsonUrl, { headers: { Accept: 'application/json' } diff --git a/layouts/partials/function/currentMenuItem.html b/layouts/partials/function/currentMenuItem.html index 8b49a03..dd70364 100644 --- a/layouts/partials/function/currentMenuItem.html +++ b/layouts/partials/function/currentMenuItem.html @@ -5,9 +5,9 @@ {{- $weight := -1 -}} {{- range site.Menus.main -}} - {{ $menu_item_url := .URL | relLangURL }} - {{ $page_url:= $currentPage.RelPermalink | relLangURL }} - {{ if eq $menu_item_url $page_url }} + {{- $menu_item_url := .URL | relLangURL -}} + {{- $page_url:= $currentPage.RelPermalink | relLangURL -}} + {{- if eq $menu_item_url $page_url -}} {{- $identifier = .Identifier -}} {{- $title = .Title -}} {{- $weight = .Weight -}} diff --git a/layouts/partials/head/favicon.html b/layouts/partials/head/favicon.html index d085b92..14d66b5 100644 --- a/layouts/partials/head/favicon.html +++ b/layouts/partials/head/favicon.html @@ -1,8 +1,8 @@ {{- if site.Params.favicon -}} {{- with site.Params.svgFavicon -}} - + {{- with site.Params.svgFaviconFallback -}} - + {{- end -}} {{- else -}} diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html index edf5112..c8c827a 100644 --- a/layouts/partials/head/link.html +++ b/layouts/partials/head/link.html @@ -1,16 +1,16 @@ -{{/* fingerprint */}} +{{- /* fingerprint */ -}} {{- $fingerprint := .Scratch.Get "fingerprint" | default "" -}} -{{/* critical style */}} +{{- /* critical style */ -}} {{- $style := dict "Source" "scss/critical.scss" "Fingerprint" $fingerprint -}} {{- $options := dict "enableSourceMap" true "includePaths" (slice "node_modules") "transpiler" "dartsass" -}} {{- $style = dict "Context" . "ToCSS" $options "Inline" true "Template" true | merge $style -}} {{- partial "plugin/style.html" $style -}} -{{- $style := dict "Link" "/bundled/css/main.css" "Defer" true -}} +{{- $style := dict "Link" ("bundled/css/main.css" | absURL) "Defer" true -}} {{- partial "plugin/style.html" $style -}} -{{/* fuck safari */}} +{{- /* fuck safari */ -}} -{{/* main js */}} -{{- $script := dict "Link" "/bundled/js/main.js" "Defer" true "Esm" true -}} +{{- /* main js */ -}} +{{- $script := dict "Link" ("bundled/js/main.js" | absURL) "Defer" true "Esm" true -}} {{- partial "plugin/script.html" $script -}} -{{/* fonts */}} - - +{{- /* fonts */ -}} + + diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index 652218d..ef163a0 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -1,22 +1,22 @@ -{{/* Title */}} +{{- /* Title */ -}} {{- $page_title := "" -}} {{- with partial "function/currentMenuItem.html" . -}} - {{ $page_title = printf "%s" site.Title | printf "%s%s" " | " | printf "%s%s" .Title | printf "%s" }} + {{- $page_title = printf "%s" site.Title | printf "%s%s" " | " | printf "%s%s" .Title | printf "%s" -}} {{- end -}} -{{ $page_title }} +{{- $page_title -}} -{{/* Basic */}} - - - +{{- /* Basic */ -}} + + + -{{/* Opengraph */}} - - +{{- /* Opengraph */ -}} + + - - - + + + -{{/* Generator */}} -{{ hugo.Generator }} +{{- /* Generator */ -}} +{{- hugo.Generator -}} diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index f49d864..2df9dc8 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -1,21 +1,21 @@ {{- with site.Params.verification.google -}} - + {{- end -}} {{- with site.Params.verification.bing -}} - + {{- end -}} {{- with site.Params.verification.yandex -}} - + {{- end -}} {{- with site.Params.verification.pinterest -}} - + {{- end -}} {{- with site.Params.verification.baidu -}} - + {{- end -}} {{- with site.Params.verification.sogou -}} - + {{- end -}} {{- with site.Params.verification.so -}} - + {{- end -}} diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index a18ff47..3722826 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,6 +1,6 @@