diff --git a/assets/css/_core/_layout/_breadcrumb.scss b/assets/css/_core/_layout/_breadcrumb.scss index 4d1bad99..3ab140c8 100644 --- a/assets/css/_core/_layout/_breadcrumb.scss +++ b/assets/css/_core/_layout/_breadcrumb.scss @@ -3,7 +3,6 @@ font-size: 0.75rem; background-color: fixit-var(global-background-color); display: flex; - gap: 0.5rem; @include z-index(sticky); &:has(~ main[data-reverse]) { @@ -23,40 +22,48 @@ &.sticky { position: sticky; - top: fixit-var(header-height); + top: 0px; + transition: top 0.5s ease; @include media('sm', 'up') { - body:not([data-header-desktop='sticky']) & { - top: 0; + [data-header-desktop='sticky'] &, + [data-header-desktop='auto'] & { + top: fixit-var(header-height); } - // adjust the scroll margin top of the content anchors on the page - body:not([data-header-desktop='auto']) &+.fi-container .content [id] { - scroll-margin-top: calc(#{fixit-var(scroll-mt)} + #{fixit-var(breadcrumb-height)}); + [data-header-desktop='auto']:has(#header-desktop.animate__fadeOutUp) & { + top: 0px; } } @include media('xs') { - body:not([data-header-mobile='sticky']) & { - top: 0; + [data-header-mobile='sticky'] &, + [data-header-mobile='auto'] & { + top: fixit-var(header-height); } - // adjust the scroll margin top of the content anchors on the page - body:not([data-header-mobile='auto']) &+.fi-container .content [id] { - scroll-margin-top: calc(#{fixit-var(scroll-mt)} + #{fixit-var(breadcrumb-height)}); + [data-header-mobile='auto']:has(#header-mobile.animate__fadeOutUp) & { + top: 0px; } } + + @include media('reduce-motion') { + transition: none; + } } .breadcrumb { display: flex; - flex-wrap: wrap; - padding: 0.5rem 0; + flex-wrap: nowrap; + padding: 0.5rem; margin: 0 auto; list-style: none; - border-bottom: 1px inset fixit-var(global-border-color); + box-shadow: inset 0 -1px 0 fixit-var(global-border-color); + overflow-x: auto; + overflow-y: hidden; @extend %page-style; .breadcrumb-item { display: flex; + flex-shrink: 0; + .breadcrumb-item::before { content: attr(data-separator); diff --git a/assets/css/_core/_layout/_comment.scss b/assets/css/_core/_layout/_comment.scss new file mode 100644 index 00000000..10687438 --- /dev/null +++ b/assets/css/_core/_layout/_comment.scss @@ -0,0 +1,28 @@ +#comments { + padding: 2rem 1rem; + display: flex; + + &::before, + &::after { + content: ''; + flex: 1; + padding-inline: 0.5rem; + + @include media('sm', 'down') { + display: none; + } + } + + .comment { + padding-inline: 0.5rem; + @extend %page-style; + + iframe { + width: 100%; + } + } + + @include media('print') { + display: none !important; + } +} diff --git a/assets/css/_core/_layout/_index.scss b/assets/css/_core/_layout/_index.scss index a661172e..29c4e29e 100644 --- a/assets/css/_core/_layout/_index.scss +++ b/assets/css/_core/_layout/_index.scss @@ -27,7 +27,6 @@ align-items: flex-start; justify-content: center; padding-inline: 1rem; - gap: 0.5rem; &[data-reverse] { flex-direction: row-reverse; @@ -53,22 +52,28 @@ } } - // adjust breadcrumb flex when asides are empty - &:has(main > aside:first-child:empty ~ aside:not(:empty)) .breadcrumb-container { - .breadcrumb { + // when left aside is hidden: expand content and remove left spacer + &:has(main > aside:first-child:empty ~ aside:not(:empty)) { + .breadcrumb-container .breadcrumb, + #comments .comment { flex: 3; } - &::before { + .breadcrumb-container::before, + #comments::before { display: none; } } - &:has(main > aside:first-child:not(:empty) ~ aside#toc-auto:empty) .breadcrumb-container { - .breadcrumb { + + // when right aside is hidden: expand content and remove right spacer + &:has(main > aside:first-child:not(:empty) ~ aside#toc-auto:empty) { + .breadcrumb-container .breadcrumb, + #comments .comment { flex: 3; } - &::after { + .breadcrumb-container::after, + #comments::after { display: none; } } @@ -79,4 +84,5 @@ @import "breadcrumb"; @import "page-style"; @import "pagination"; +@import "comment"; @import "footer"; diff --git a/assets/css/_core/_mixin/_index.scss b/assets/css/_core/_mixin/_index.scss index f702dd0c..dc9fcf97 100644 --- a/assets/css/_core/_mixin/_index.scss +++ b/assets/css/_core/_mixin/_index.scss @@ -6,5 +6,6 @@ @import 'loading'; @import 'media'; @import 'scrollbar-width'; +@import 'sticky-top'; @import 'theme-vars'; @import 'z-index'; diff --git a/assets/css/_core/_mixin/_sticky-top.scss b/assets/css/_core/_mixin/_sticky-top.scss new file mode 100644 index 00000000..d2835fff --- /dev/null +++ b/assets/css/_core/_mixin/_sticky-top.scss @@ -0,0 +1,56 @@ +/// Apply the shared sticky top offset used by TOC, collections, and code headers. +/// +/// @param {boolean} $transition - Whether to include the transition for top changes (default: true). +/// +/// Top offset rules: +/// - Base: keep space for the breadcrumb bar when no sticky header override applies. +/// - Desktop auto: offset by header height while the header is visible. +/// - Desktop auto hidden: reset to 0 when the auto header has faded out. +/// - Desktop/mobile sticky: offset by header height plus breadcrumb height. +@mixin sticky-top-offset($transition: true) { + $sticky-top-bar-offset: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height, 0px)}); + $base-top-offset: fixit-var(breadcrumb-height, 0px); + + // Base offset reserved for the breadcrumb bar. + top: $base-top-offset; + + @include media('sm', 'up') { + [data-header-desktop='sticky'] &, + [data-header-desktop='auto'] & { + // Sticky or auto desktop header uses the same combined header and breadcrumb offset. + top: $sticky-top-bar-offset; + } + + [data-header-desktop='auto']:has(#header-desktop.animate__fadeOutUp) & { + // Once the auto header is hidden, remove the extra top offset. + top: $base-top-offset; + } + } + + @include media('xs') { + [data-header-mobile='sticky'] &, + [data-header-mobile='auto'] & { + // Sticky or auto mobile header uses the same combined header and breadcrumb offset. + top: $sticky-top-bar-offset; + } + + [data-header-mobile='auto']:has(#header-mobile.animate__fadeOutUp) & { + // Once the auto header is hidden, remove the extra top offset. + top: $base-top-offset; + } + } + + [data-header-mobile='sticky'] & { + @include media('xs') { + // Sticky mobile header uses the same combined header and breadcrumb offset. + top: $sticky-top-bar-offset; + } + } + + @if $transition { + transition: top 0.5s ease; + @include media('reduce-motion') { + transition: none; + } + } +} diff --git a/assets/css/_core/_root.scss b/assets/css/_core/_root.scss index f1bc7814..d12aacff 100644 --- a/assets/css/_core/_root.scss +++ b/assets/css/_core/_root.scss @@ -26,7 +26,6 @@ global-font-size: $global-font-size, global-font-weight: $global-font-weight, global-line-height: $global-line-height, - global-scroll-margin-top: $global-scroll-margin-top, global-border-radius: $global-border-radius, // Header @@ -59,10 +58,12 @@ bezier: cubic-bezier(.4, 0, .2, 1), // Other utilities - breadcrumb-height: 0px, divider-edge-weak: linear-gradient(to right, transparent, fixit-var(divider-bg, #d0d0d5), transparent), - scroll-mt: calc(#{fixit-var(header-height)} + #{fixit-var(global-scroll-margin-top)}), )); + + &:has(.breadcrumb-container.sticky) { + @include set-fixit-var(breadcrumb-height, 2.5rem); + } } // ---------------------------------------- diff --git a/assets/css/_page/_index.scss b/assets/css/_page/_index.scss index aca3af0a..8a207ed7 100644 --- a/assets/css/_page/_index.scss +++ b/assets/css/_page/_index.scss @@ -1,20 +1,33 @@ .page { position: relative; + padding-inline: 0.5rem; @extend %page-style; .content { [id] { - scroll-margin-top: fixit-var(scroll-mt); + scroll-margin-top: fixit-var(scroll-margin-top, 0.5rem); - [data-header-desktop='normal'] & { - @include media('xs', 'up') { - @include set-fixit-var(scroll-mt, fixit-var(global-scroll-margin-top)); + @include media('sm', 'up') { + [data-header-desktop='sticky'] &, + [data-header-desktop='auto'] & { + @include set-fixit-var(scroll-margin-top, calc(#{fixit-var(header-height)} + 0.5rem)); + } + + [data-header-desktop='sticky']:has(.breadcrumb-container.sticky) &, + [data-header-desktop='auto']:has(.breadcrumb-container.sticky) & { + @include set-fixit-var(scroll-margin-top, calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height, 0px)} + 0.5rem)); } } - [data-header-mobile='normal'] & { - @include media('xs') { - @include set-fixit-var(scroll-mt, fixit-var(global-scroll-margin-top)); + @include media('xs') { + [data-header-mobile='sticky'] &, + [data-header-mobile='auto'] & { + @include set-fixit-var(scroll-margin-top, calc(#{fixit-var(header-height)} + 0.5rem)); + } + + [data-header-mobile='sticky']:has(.breadcrumb-container.sticky) &, + [data-header-mobile='auto']:has(.breadcrumb-container.sticky) & { + @include set-fixit-var(scroll-margin-top, calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height, 0px)} + 0.5rem)); } } } diff --git a/assets/css/_page/_single/_code.scss b/assets/css/_page/_single/_code.scss index 7825b4c6..116f5a70 100644 --- a/assets/css/_page/_single/_code.scss +++ b/assets/css/_page/_single/_code.scss @@ -159,6 +159,10 @@ pre { line-start: attr(data-line-start number, 1), line-digit: attr(data-line-digit number, 1), )); + + @include media('reduce-motion') { + transition: none; + } } // code preview @@ -183,11 +187,11 @@ pre { color: fixit-var(code-header-color); background-color: fixit-var(code-header-background-color); position: sticky; - top: fixit-var(breadcrumb-height); transition: border-radius 0s; cursor: pointer; - @include z-index(base); + @include z-index(base, 1); @include border-radius(top); + @include sticky-top-offset; + .code-wrapper { @include border-radius(bottom); @@ -226,7 +230,7 @@ pre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - @include z-index(base, 1); + @include z-index(base, 2); } } @@ -268,18 +272,6 @@ pre { } } - [data-header-desktop='sticky'] & { - @include media('sm', 'up') { - top: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height)}); - } - } - - [data-header-mobile='sticky'] & { - @include media('xs') { - top: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height)}); - } - } - @include media('print') { top: initial !important; } @@ -618,9 +610,9 @@ pre { color: fixit-var(code-header-color); background-color: fixit-var(code-header-background-color); position: sticky; - top: fixit-var(breadcrumb-height); - @include z-index(base); + @include z-index(base, 1); @include border-radius(top); + @include sticky-top-offset; .tabs-items { display: flex; @@ -698,18 +690,6 @@ pre { } } - [data-header-desktop='sticky'] & { - @include media('sm', 'up') { - top: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height)}); - } - } - - [data-header-mobile='sticky'] & { - @include media('xs') { - top: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height)}); - } - } - @include media('print') { top: initial !important; } diff --git a/assets/css/_page/_single/_collections.scss b/assets/css/_page/_single/_collections.scss index 9599ef52..9ef37871 100644 --- a/assets/css/_page/_single/_collections.scss +++ b/assets/css/_page/_single/_collections.scss @@ -89,10 +89,11 @@ // Collection aside container .aside-collection { position: sticky; - top: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height)}); box-sizing: border-box; + margin-bottom: 8rem; @include overflow-wrap(break-word); @include blur; + @include sticky-top-offset; @include media('print') { display: none !important; diff --git a/assets/css/_page/_single/_comment.scss b/assets/css/_page/_single/_comment.scss deleted file mode 100644 index 04ecce07..00000000 --- a/assets/css/_page/_single/_comment.scss +++ /dev/null @@ -1,11 +0,0 @@ -> #comments { - padding: 2rem 0; - - iframe { - width: 100%; - } - - @include media('print') { - display: none !important; - } -} diff --git a/assets/css/_page/_single/_index.scss b/assets/css/_page/_single/_index.scss index c39de7a2..c83215fe 100644 --- a/assets/css/_page/_single/_index.scss +++ b/assets/css/_page/_single/_index.scss @@ -543,7 +543,7 @@ @import 'diagram-copy-btn'; @import 'reward'; @import 'footer'; - @import 'comment'; + // @import 'comment'; } .lg-toolbar .lg-icon::after { diff --git a/assets/css/_page/_single/_toc.scss b/assets/css/_page/_single/_toc.scss index 73bcce6b..7baefd25 100644 --- a/assets/css/_page/_single/_toc.scss +++ b/assets/css/_page/_single/_toc.scss @@ -89,15 +89,12 @@ #toc-auto { display: block; position: sticky; - top: calc(#{fixit-var(header-height)} + #{fixit-var(breadcrumb-height)}); box-sizing: border-box; visibility: hidden; + margin-bottom: 8rem; @include overflow-wrap(break-word); @include blur; - - [data-header-desktop='normal'] & { - @include set-fixit-var(scroll-mt, fixit-var(global-scroll-margin-top)); - } + @include sticky-top-offset; .toc-title { margin-block: 0 0.5em; diff --git a/assets/css/_variables.scss b/assets/css/_variables.scss index 1a9b0192..ab6eeae1 100644 --- a/assets/css/_variables.scss +++ b/assets/css/_variables.scss @@ -14,9 +14,6 @@ $global-font-size: 16px !default; $global-font-weight: 400 !default; $global-line-height: 1.5rem !default; -// scroll-margin-top of content anchor -$global-scroll-margin-top: 0.5rem !default; - // Radius of the border $global-border-radius: 5px !default; diff --git a/assets/js/theme.js b/assets/js/theme.js index 34312f1f..77206e9c 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -399,14 +399,6 @@ class FixIt { initAutosearch(); } - initBreadcrumb() { - const $breadcrumbContainer = document.querySelector('.breadcrumb-container.sticky') - this.breadcrumbHeight = $breadcrumbContainer?.clientHeight ?? 0; - if (this.breadcrumbHeight) { - document.querySelector('main.fi-container')?.style.setProperty('--fi-breadcrumb-height', `${this.breadcrumbHeight}px`); - } - } - initDetails(target = document) { forEach(target.querySelectorAll('.details:not(.disabled)'), ($details) => { const $summary = $details.querySelector('.details-summary'); @@ -860,14 +852,11 @@ class FixIt { const $toc = document.getElementById('toc-auto'); $toc.style.visibility = 'visible'; animateCSS($toc, ['animate__fadeIn', 'animate__faster'], true); - const $postMeta = document.querySelector('.post-meta'); - $toc.style.marginTop = `${$postMeta.offsetTop + $postMeta.clientHeight}px`; - - document.querySelector('.fi-container').addEventListener('resize', () => { - $toc.style.marginBottom = `${document.querySelector('.fi-container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; - }); + // document.querySelector('.fi-container').addEventListener('resize', () => { + // $toc.style.marginBottom = `${document.querySelector('.fi-container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; + // }); this._tocOnScroll = this._tocOnScroll || (() => { - $toc.style.marginBottom = `${document.querySelector('.fi-container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; + // $toc.style.marginBottom = `${document.querySelector('.fi-container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; this._updateTocActiveState($tocCore, $headingElements, INDEX_OFFSET); }); this._tocOnScroll(); @@ -1694,7 +1683,6 @@ class FixIt { this.initMenu(); this.initSwitchTheme(); this.initSearch(); - this.initBreadcrumb(); this.initCookieconsent(); this.initSiteTime(); this.initServiceWorker(); diff --git a/i18n/de.toml b/i18n/de.toml index d217ae22..02aa17ae 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Hugo-Version ist zu niedrig.\n\nAktuelle Hugo-Version ist {{ .Current }}, die minimal unterstützte Version für FixIt ist {{ .Minimal }}.\n\nWenn Sie Hugo auf Ihrem eigenen Computer ausführen, schauen Sie sich https://gohugo.io/getting-started/installing/#upgrade-hugo für eine Upgrade-Anleitung an.\n\nWenn Sie auf einer Drittanbieterplattform bereitstellen, konfigurieren Sie bitte die Hugo-Version entsprechend." +hugoExtendedWarn = "Die Hugo Extended-Version ist für die Unterstützung von SCSS erforderlich." configurationError = "Konfigurationsfehler\nSie haben den FixIt-Versionsparameter noch nicht korrekt konfiguriert. Siehe https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Kompatibilitätsfehler ({{ .From }} -> {{ .To }}):\nSie haben ein inkompatibles Update. Siehe https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Sie verwenden eine Entwicklungsversion von FixIt. Bitte erwägen Sie die Verwendung einer stabilen Version.\nSiehe https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/en.toml b/i18n/en.toml index c60d6d7f..f883ae09 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -3,6 +3,8 @@ # === init === [init] +hugoVersionError = "Hugo version is too low.\n\nCurrent Hugo version is {{ .Current }}, the minimum supported version for FixIt is {{ .Minimal }}.\n\nIf you are running Hugo on your own computer, check out https://gohugo.io/getting-started/installing/#upgrade-hugo for upgrading guide.\n\nIf you are deploying on a third-party platform, please configure Hugo version accordingly." +hugoExtendedWarn = "The Hugo Extended version is necessary for SCSS support." configurationError = "Configuration Error\nYou haven't configured the FixIt version param correctly yet. See https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Compatibility Error ({{ .From }} -> {{ .To }}):\nYou have an incompatible update. See https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "You are using a development version of FixIt. Please consider using a stable version.\nSee https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/es.toml b/i18n/es.toml index cb7c4703..832665a9 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Hugo versión es demasiado baja.\n\nLa versión actual de Hugo es {{ .Current }}, la versión mínima compatible para FixIt es {{ .Minimal }}.\n\nSi estás ejecutando Hugo en tu propia computadora, consulta https://gohugo.io/getting-started/installing/#upgrade-hugo para obtener una guía de actualización.\n\nSi estás desplegando en una plataforma de terceros, por favor configura la versión de Hugo en consecuencia." +hugoExtendedWarn = "La versión extendida de Hugo es necesaria para el soporte de SCSS." configurationError = "Error de configuración\nAún no ha configurado correctamente el parámetro de versión de FixIt. Consulte https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Error de compatibilidad ({{ .From }} -> {{ .To }}):\nTiene una actualización incompatible. Consulte https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Está utilizando una versión de desarrollo de FixIt. Considere usar una versión estable.\nConsulte https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/fr.toml b/i18n/fr.toml index d3bdba94..6d009a28 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "La version de Hugo est trop ancienne.\n\nLa version actuelle de Hugo est {{ .Current }}, la version minimale requise pour FixIt est {{ .Minimal }}.\n\nSi vous utilisez Hugo sur votre ordinateur, consultez le guide de mise à niveau à l'adresse https://gohugo.io/getting-started/installing/#upgrade-hugo.\n\nSi vous déployez sur une plateforme tierce, veuillez configurer la version de Hugo en conséquence." +hugoExtendedWarn = "La version étendue de Hugo est nécessaire pour la prise en charge de SCSS." configurationError = "Erreur de configuration\nVous n'avez pas configuré la version de FixIt correctement. Voir https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Erreur de compatibilité ({{ .From }} -> {{ .To }}):\nVous avez une mise à jour incompatible. Voir https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Vous utilisez une version de développement de FixIt. Veuillez considérer l'utilisation d'une version stable.\nVoir https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/hi.toml b/i18n/hi.toml index b80c991a..d1bcc7da 100644 --- a/i18n/hi.toml +++ b/i18n/hi.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Hugo संस्करण बहुत पुराना है।\n\nवर्तमान में उपयोग किया जा रहा Hugo संस्करण {{ .Current }} है, जबकि FixIt के लिए न्यूनतम आवश्यक संस्करण {{ .Minimal }} है।\n\nयदि आप अपने कंप्यूटर पर Hugo का उपयोग कर रहे हैं, तो कृपया अपग्रेड गाइड देखें: https://gohugo.io/getting-started/installing/#upgrade-hugo\n\nयदि आप किसी तृतीय-पक्ष प्लेटफ़ॉर्म पर तैनात कर रहे हैं, तो कृपया Hugo संस्करण को तदनुसार कॉन्फ़िगर करें। " +hugoExtendedWarn = "SCSS समर्थन के लिए Hugo Extended संस्करण आवश्यक है।" configurationError = "कन्फ़िग्यरेशन त्रुटि \nआपने फिक्सइट संस्करण पैरामीटर को सही ढंग से कॉन्फ़िगर नहीं किया है।. यह देखें: https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "संगतता त्रुटि ({{ .From }} -> {{ .To }}):\nआपके पास एक असंगत अपडेट है. यह देखें: https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "आप फिक्सइट के डिवेलपर संस्करण का उपयोग कर रहे हैं। कृपया एक स्थिर संस्करण का उपयोग करने पर विचार करें।\nयह देखें: https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/it.toml b/i18n/it.toml index 9dff9e15..fc502f96 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "La versione di Hugo è troppo bassa.\n\nLa versione attuale di Hugo è {{ .Current }}, la versione minima supportata per FixIt è {{ .Minimal }}.\n\nSe stai eseguendo Hugo sul tuo computer, consulta https://gohugo.io/getting-started/installing/#upgrade-hugo per la guida all'aggiornamento.\n\nSe stai distribuendo su una piattaforma di terze parti, configura la versione di Hugo di conseguenza." +hugoExtendedWarn = "La versione Hugo Extended è necessaria per il supporto SCSS." configurationError = "Errore di configurazione\nNon hai ancora configurato correttamente il parametro della versione di FixIt. Vedi https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Errore di compatibilità ({{ .From }} -> {{ .To }}):\nHai un aggiornamento incompatibile. Vedi https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Stai utilizzando una versione di sviluppo di FixIt. Si prega di considerare l'utilizzo di una versione stabile.\nVedi https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/ja.toml b/i18n/ja.toml index d4c81f98..8a9f5615 100644 --- a/i18n/ja.toml +++ b/i18n/ja.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Hugo のバージョンが低すぎます。\n\n現在の Hugo バージョンは {{ .Current }} ですが、FixIt がサポートする最小バージョンは {{ .Minimal }} です。\n\n自分のコンピューターで Hugo を実行している場合は、https://gohugo.io/getting-started/installing/#upgrade-hugo でアップグレードガイドを参照してください。\n\nサードパーティプラットフォームにデプロイしている場合は、Hugo バージョンを適切に設定してください。" +hugoExtendedWarn = "SCSS サポートには Hugo Extended バージョンが必要です。" configurationError = "設定ファイルエラー\nまだ FixIt のバージョンパラメータを正しく設定していません。 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration を参照してください" compatibilityError = "互換性エラー ({{ .From }} -> {{ .To }}):\n互換性のない更新が行われました。 https://github.com/hugo-fixit/FixIt/releases を参照してください" devVersionWarn = "開発版の FixIt を使用しています。安定版の使用を検討してください。\n https://github.com/hugo-fixit/FixIt/releases を参照" diff --git a/i18n/ko.toml b/i18n/ko.toml index 50973efb..ef9fa258 100644 --- a/i18n/ko.toml +++ b/i18n/ko.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Hugo 버전이 너무 낮습니다.\n\n현재 Hugo 버전은 {{ .Current }}이며, FixIt의 최소 지원 버전은 {{ .Minimal }}입니다.\n\n자신의 컴퓨터에서 Hugo를 실행 중이라면 https://gohugo.io/getting-started/installing/#upgrade-hugo에서 업그레이드 가이드를 확인하세요.\n\n타사 플랫폼에 배포 중이라면 Hugo 버전을 적절히 설정해 주세요." +hugoExtendedWarn = "SCSS 지원을 위해 Hugo Extended 버전이 필요합니다." configurationError = "구성 파일 오류\n아직 FixIt의 버전 매개변수를 올바르게 구성하지 않았습니다. https://fixit.lruihao.cn/ko/documentation/basics/#theme-configuration을 참조하세요." compatibilityError = "호환성 오류 ({{ .From }} -> {{ .To }}):\n비호환 업데이트를 수행했습니다. https://github.com/hugo-fixit/FixIt/releases를 참조하세요." devVersionWarn = "현재 개발 버전의 FixIt을 사용 중입니다. 안정적인 버전을 사용하는 것이 좋습니다.\n자세한 내용은 https://github.com/hugo-fixit/FixIt/releases를 참조하세요." diff --git a/i18n/pl.toml b/i18n/pl.toml index 67050e97..af4388b7 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Wersja Hugo jest zbyt niska.\n\nAktualna wersja Hugo to {{ .Current }}, minimalna obsługiwana wersja dla FixIt to {{ .Minimal }}.\n\nJeśli uruchamiasz Hugo na własnym komputerze, zapoznaj się z przewodnikiem aktualizacji na stronie https://gohugo.io/getting-started/installing/#upgrade-hugo.\n\nJeśli wdrażasz na platformie zewnętrznej, skonfiguruj odpowiednio wersję Hugo." +hugoExtendedWarn = "Wersja Hugo Extended jest wymagana do obsługi SCSS." configurationError = "Błąd konfiguracji\nNie skonfigurowałeś jeszcze poprawnie parametru wersji FixIt. Zobacz https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Błąd zgodności ({{ .From }} -> {{ .To }}):\nMasz niekompatybilną aktualizację. Zobacz https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Używasz wersji deweloperskiej FixIt. Proszę rozważyć użycie stabilnej wersji.\nZobacz https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index 69d88749..a40abb9c 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "A versão do Hugo é muito baixa.\n\nA versão atual do Hugo é {{ .Current }}, a versão mínima suportada pelo FixIt é {{ .Minimal }}.\n\nSe você está executando o Hugo em seu computador, consulte https://gohugo.io/getting-started/installing/#upgrade-hugo para obter um guia de atualização.\n\nSe você está implantando em uma plataforma de terceiros, configure a versão do Hugo adequadamente." +hugoExtendedWarn = "A versão Hugo Extended é necessária para o suporte a SCSS." configurationError = "Erro de configuração\nVocê ainda não configurou o parâmetro da versão do FixIt corretamente. Consulte https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Erro de compatibilidade ({{ .From }} -> {{ .To }}):\nVocê tem uma atualização incompatível. Consulte https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Você está usando a versão de desenvolvedor do FixIt. Por favor, use uma versão estável. \nConsulte https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/ro.toml b/i18n/ro.toml index e14accbb..0b5d05cc 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Versiunea Hugo este prea veche.\n\nVersiunea curentă Hugo este {{ .Current }}, versiunea minimă compatibilă cu FixIt este {{ .Minimal }}.\n\nDacă rulați Hugo pe propriul computer, consultați https://gohugo.io/getting-started/installing/#upgrade-hugo pentru ghidul de actualizare.\n\nDacă implementați pe o platformă terță, configurați versiunea Hugo corespunzător." +hugoExtendedWarn = "Versiunea Hugo Extended este necesară pentru suportul SCSS." configurationError = "Eroare de configurare\nNu ați configurat corect parametrul versiunii FixIt. Consultați https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Eroare de compatibilitate ({{ .From }} -> {{ .To }}):\nAveți o actualizare incompatibilă. Consultați https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Utilizați o versiune de dezvoltare a FixIt. Vă rugăm să luați în considerare utilizarea unei versiuni stabile.\nConsultați https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/ru.toml b/i18n/ru.toml index 221fda9e..c28b975f 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Версия Hugo слишком низкая.\n\nТекущая версия Hugo — {{ .Current }}, минимальная поддерживаемая версия для FixIt — {{ .Minimal }}.\n\nЕсли вы запускаете Hugo на своём компьютере, ознакомьтесь с руководством по обновлению по адресу https://gohugo.io/getting-started/installing/#upgrade-hugo.\n\nЕсли вы развёртываете на сторонней платформе, настройте версию Hugo соответствующим образом." +hugoExtendedWarn = "Для поддержки SCSS необходима версия Hugo Extended." configurationError = "Ошибка конфигурации\nВы еще не настроили параметр версии FixIt правильно. См. https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Ошибка совместимости ({{ .From }} -> {{ .To }}):\nУ вас есть несовместимое обновление. См. https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Вы используете версию разработки FixIt. Пожалуйста, рассмотрите возможность использования стабильной версии.\nСм. https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/sr.toml b/i18n/sr.toml index e4a65cb8..14d0343f 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -4,6 +4,8 @@ # === init === [init] +hugoVersionError = "Верзија Hugo-а је прениска.\n\nТренутна верзија Hugo-а је {{ .Current }}, а минимална подржана верзија за FixIt је {{ .Minimal }}.\n\nАко покрећете Hugo на свом рачунару, погледајте https://gohugo.io/getting-started/installing/#upgrade-hugo за водич за надоградњу.\n\nАко постављате на платформу треће стране, конфигуришите верзију Hugo-а у складу с тим." +hugoExtendedWarn = "Верзија Hugo Extended је неопходна за подршку SCSS-а." configurationError = "Грешка у конфигурацији\nНисте правилно конфигурисали параметар верзије FixIt. Погледајте https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Грешка у компатибилности ({{ .From }} -> {{ .To }}):\nИмате некомпатибилно ажурирање. Погледајте https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Користите развојну верзију FixIt. Размотрите коришћење стабилне верзије.\nПогледајте https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/vi.toml b/i18n/vi.toml index 1e68c384..fb3d2f4a 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -3,6 +3,8 @@ # === init === [init] +hugoVersionError = "Phiên bản Hugo quá thấp.\n\nPhiên bản Hugo hiện tại là {{ .Current }}, phiên bản tối thiểu được hỗ trợ cho FixIt là {{ .Minimal }}.\n\nNếu bạn đang chạy Hugo trên máy tính của mình, hãy xem https://gohugo.io/getting-started/installing/#upgrade-hugo để biết hướng dẫn nâng cấp.\n\nNếu bạn đang triển khai trên nền tảng của bên thứ ba, vui lòng cấu hình phiên bản Hugo cho phù hợp." +hugoExtendedWarn = "Phiên bản Hugo Extended là cần thiết để hỗ trợ SCSS." configurationError = "Lỗi cấu hình\nBạn chưa cấu hình tham số phiên bản FixIt đúng cách. Xem https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Lỗi tương thích ({{ .From }} -> {{ .To }}):\nBạn có một bản cập nhật không tương thích. Xem https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Bạn đang sử dụng một phiên bản phát triển của FixIt. Vui lòng xem xét sử dụng một phiên bản ổn định.\nXem https://github.com/hugo-fixit/FixIt/releases" diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index c56c6aa1..3cb58015 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -4,9 +4,11 @@ # === init === [init] -configurationError = "配置文件错误\n您还没有正确配置 FixIt 的版本参数。参考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration" -compatibilityError = "兼容性错误 ({{ .From }} -> {{ .To }}):\n您进行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases" -devVersionWarn = "您正在使用开发版的 FixIt,请考虑使用稳定版。\n见 https://github.com/hugo-fixit/FixIt/releases" +hugoVersionError = "Hugo 版本过低。\n\n目前使用的 Hugo 版本为 {{ .Current }},FixIt 支持的最低的 Hugo 版本为 {{ .Minimal }}。\n\n如果你正在自己的计算机上运行 Hugo,请访问 https://gohugo.io/getting-started/installing/#upgrade-hugo 以查阅升级指南。\n\n如果你正在第三方平台上部署,请按照相应文档配置 Hugo 版本。" +hugoExtendedWarn = "需要使用 Hugo Extended 版本来获得 SCSS 支持。" +configurationError = "配置文件错误\n你还没有正确配置 FixIt 的版本参数。参考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration" +compatibilityError = "兼容性错误 ({{ .From }} -> {{ .To }}):\n你进行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases" +devVersionWarn = "你正在使用开发版的 FixIt,请考虑使用稳定版。\n见 https://github.com/hugo-fixit/FixIt/releases" devEnvWarn = "当前运行环境是“development”。“评论系统”、“PWA”、“CDN”、“fingerprint”和“统计”不会启用。" quicklyUpgrade = "使用命令快速升级:" # === init === @@ -103,7 +105,7 @@ toggleCodeEditable = "切换可编辑代码块" downloadCode = "下载代码" toggleCodeFullscreen = "切换代码块全屏" expandCode = "展开或折叠代码块" -cookieconsentMessage = "本网站使用 Cookies 来改善您的浏览体验。" +cookieconsentMessage = "本网站使用 Cookies 来改善你的浏览体验。" cookieconsentDismiss = "同意" cookieconsentLink = "了解更多" # === partials/assets.html === @@ -166,7 +168,7 @@ bitcoin = "比特币" other = "页面没找到" [pageNotFoundText] -other = "抱歉,您要查找的页面不存在。" +other = "抱歉,你要查找的页面不存在。" # === 404.html === # === offline === @@ -174,7 +176,7 @@ other = "抱歉,您要查找的页面不存在。" other = "离线" [offlineText] -other = "您没有连接到 Internet,只有缓存的页面可用。" +other = "你没有连接到 Internet,只有缓存的页面可用。" # === offline === # === GitHub Alert === diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index d6400646..6705d72e 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -4,9 +4,11 @@ # === init === [init] -configurationError = "配置文件錯誤\n您還沒有正確配置 FixIt 的版本參數。參考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration" -compatibilityError = "兼容性錯誤 ({{ .From }} -> {{ .To }}):\n您進行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases" -devVersionWarn = "您正在使用開發版的 FixIt,請考慮使用穩定版。\n見 https://github.com/hugo-fixit/FixIt/releases" +hugoVersionError = "Hugo 版本過低。\n\n目前使用的 Hugo 版本為 {{ .Current }},FixIt 支持的最老的 Hugo 版本為 {{ .Minimal }}。\n\n如果你正在自己的計算機上運行 Hugo,請訪問 https://gohugo.io/getting-started/installing/#upgrade-hugo 以查閱升級指南。\n\n如果你正在第三方平台上部署,請按照相應文檔配置 Hugo 版本。" +hugoExtendedWarn = "需要使用 Hugo Extended 版本來獲得 SCSS 支持。" +configurationError = "配置文件錯誤\n你還沒有正確配置 FixIt 的版本參數。參考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration" +compatibilityError = "兼容性錯誤 ({{ .From }} -> {{ .To }}):\n你進行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases" +devVersionWarn = "你正在使用開發版的 FixIt,請考慮使用穩定版。\n見 https://github.com/hugo-fixit/FixIt/releases" devEnvWarn = "當前運行環境是“development”。“評論系統”、“PWA”、“CDN”、“fingerprint”和“統計”不會啟用。" quicklyUpgrade = "使用命令快速升級:" # === init === @@ -103,7 +105,7 @@ toggleCodeEditable = "切換可編輯程式碼區塊" downloadCode = "下載程式碼" toggleCodeFullscreen = "切換程式碼區塊全螢幕" expandCode = "展開或摺疊程式碼區塊" -cookieconsentMessage = "本網站使用 Cookies 來改善您的流覽體驗。" +cookieconsentMessage = "本網站使用 Cookies 來改善你的流覽體驗。" cookieconsentDismiss = "同意" cookieconsentLink = "瞭解更多" # === partials/assets.html === @@ -166,7 +168,7 @@ bitcoin = "比特幣" other = "找不到網頁" [pageNotFoundText] -other = "抱歉,您要查找的頁面不存在。" +other = "抱歉,你要查找的頁面不存在。" # === 404.html === # === offline === @@ -174,7 +176,7 @@ other = "抱歉,您要查找的頁面不存在。" other = "離線" [offlineText] -other = "您沒有連接到 Internet,只有緩存的頁面可用。" +other = "你沒有連接到 Internet,只有緩存的頁面可用。" # === offline === # === GitHub Alert === diff --git a/layouts/_partials/devtools/template-call-stack.html b/layouts/_partials/_debug/template-call-stack.html similarity index 85% rename from layouts/_partials/devtools/template-call-stack.html rename to layouts/_partials/_debug/template-call-stack.html index 57d3bc24..f9d5543a 100644 --- a/layouts/_partials/devtools/template-call-stack.html +++ b/layouts/_partials/_debug/template-call-stack.html @@ -1,6 +1,6 @@ {{- /* Render template call stack for debugging purpose. - Call the partial from any template: {{- partial "devtools/template-call-stack.html" . -}} + Call the partial from any template: {{- partial "_debug/template-call-stack.html" . -}} */ -}} {{- $debug := (site.Store.Get "devOpts").debug -}} diff --git a/layouts/_partials/head/link.html b/layouts/_partials/head/link.html deleted file mode 100644 index 61bebf08..00000000 --- a/layouts/_partials/head/link.html +++ /dev/null @@ -1,61 +0,0 @@ -{{- $cdn := .Site.Store.Get "cdn" | default dict -}} -{{- $fingerprint := .Site.Store.Get "fingerprint" -}} -{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}} -{{- if .IsHome -}} - {{- $title = site.Title -}} -{{- end -}} - -{{- if not .Site.Params.app.noFavicon -}} - {{- $relURL := relURL "" -}} - {{- with .Site.Params.app.svgFavicon -}} - - {{- else -}} - - - - {{- end -}} - - {{- with .Site.Params.app.iconColor -}} - - {{- end -}} - {{- if eq .Site.Params.enablePWA true -}} - - {{- end -}} -{{- end -}} - - -{{- with .Prev -}} - -{{- end -}} -{{- with .Next -}} - -{{- end -}} -{{- range .AlternativeOutputFormats -}} - {{- printf `` .Rel .MediaType.Type .Permalink $title | safeHTML -}} -{{- end -}} -{{- /* Compatible with https://github.com/hugo-fixit/hugo-json-feed */ -}} -{{- with .OutputFormats.Get "jsonfeed" -}} - -{{- end -}} - -{{- /* config.min.css */ -}} -{{- $options := dict "Source" "css/config.template.scss" "Template" "css/config.scss" "Fingerprint" $fingerprint -}} -{{- $toCSS := dict "targetPath" "css/config.min.css" "enableSourceMap" true -}} -{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}} -{{- partial "plugin/style.html" $options -}} - -{{- /* style.min.css */ -}} -{{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}} -{{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}} -{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}} -{{- partial "plugin/style.html" $options -}} - -{{- /* Font Awesome */ -}} -{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}} -{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} -{{- partial "plugin/style.html" $options -}} - -{{- /* Animate.css */ -}} -{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}} -{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} -{{- partial "plugin/style.html" $options -}} diff --git a/layouts/_partials/head/meta.html b/layouts/_partials/head/meta.html deleted file mode 100644 index 14357f17..00000000 --- a/layouts/_partials/head/meta.html +++ /dev/null @@ -1,54 +0,0 @@ -{{- $author := partial "function/get-author-map.html" .Params.author -}} - - - - -{{- $keywords := .Keywords -}} -{{- if not $keywords -}} - {{- if .IsPage | and .Params.tags -}} - {{- $keywords = .Params.tags -}} - {{- else -}} - {{- $keywords = .Site.Params.keywords -}} - {{- end -}} -{{- end -}} -{{- with $keywords -}} - -{{- end -}} - -{{- template "_internal/schema.html" . -}} -{{- template "_internal/opengraph.html" . -}} -{{- template "_internal/twitter_cards.html" . -}} -{{- with .Site.Params.social.Twitter -}} - -{{- end -}} - - - - -{{- with .Site.Params.app.themeColor -}} - {{- $color := . -}} - {{- if ne (len $color) 2 -}} - {{- $color = dict "light" . "dark" . -}} - {{- end -}} - -{{- end -}} - -{{- with .Site.Params.app.tileColor -}} - -{{- end -}} - -{{- /* Mastodon Validation for the site */ -}} -{{- with .Site.Params.social.Mastodon -}} - {{- $id := "" -}} - {{- $prefix := "https://mastodon.social/" -}} - {{- if reflect.IsMap . -}} - {{- $id = .Id | default .id -}} - {{- $prefix = .Prefix | default .prefix | default $prefix -}} - {{- end -}} - {{- if $id | and $prefix -}} - {{- $link := printf "%s/%s" $prefix $id -}} - {{- $email := printf "%s@%s" (strings.TrimPrefix "@" $id) (urls.Parse $prefix).Host -}} - - - {{- end -}} -{{- end -}} diff --git a/layouts/_partials/head/script.html b/layouts/_partials/head/script.html deleted file mode 100644 index b13f3314..00000000 --- a/layouts/_partials/head/script.html +++ /dev/null @@ -1,9 +0,0 @@ -{{- $fingerprint := .Site.Store.Get "fingerprint" -}} - -{{- /* Check theme isDark before body rendering */ -}} -{{- $options := dict "targetPath" "js/head/color-scheme.min.js" "minify" hugo.IsProduction -}} -{{- $options := dict "defaultTheme" .Site.Params.defaulttheme | dict "params" | merge $options -}} -{{- if not hugo.IsProduction -}} - {{- $options = dict "sourceMap" "external" | merge $options -}} -{{- end -}} -{{- dict "Source" (resources.Get "js/head/color-scheme.js") "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}} diff --git a/layouts/_partials/head/seo.html b/layouts/_partials/head/seo.html deleted file mode 100644 index 4df649d5..00000000 --- a/layouts/_partials/head/seo.html +++ /dev/null @@ -1,167 +0,0 @@ -{{- $params := partial "function/params.html" -}} - -{{- 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.so -}} - -{{- end -}} -{{- with .Site.Params.verification.sogou -}} - -{{- end -}} - -{{- /* Home SEO */ -}} -{{- if .IsHome -}} - - -{{- /* Page SEO */ -}} -{{- else if .IsPage -}} - {{- $authorName := .Site.Params.author.name | default (T "single.author") -}} - {{- with .Params.author -}} - {{- if reflect.IsMap . -}} - {{- $authorName = cond (isset . "name") .name $authorName -}} - {{- else -}} - {{- $authorName = . -}} - {{- end -}} - {{- end -}} - -{{- end -}} diff --git a/layouts/_partials/plugin/compatibility.html b/layouts/_partials/init/compatibility.html similarity index 100% rename from layouts/_partials/plugin/compatibility.html rename to layouts/_partials/init/compatibility.html diff --git a/layouts/_partials/init/detection-version.html b/layouts/_partials/init/detection-version.html index a77db662..705cbb99 100644 --- a/layouts/_partials/init/detection-version.html +++ b/layouts/_partials/init/detection-version.html @@ -2,6 +2,17 @@ {{- $latest := $version -}} {{- $devOpts := .Site.Store.Get "devOpts" -}} +{{- /* Check Hugo version */ -}} +{{- $MINIMAL_HUGO_VERSION := "0.156.0" -}} +{{- if lt hugo.Version $MINIMAL_HUGO_VERSION -}} + {{- errorf "\n\n%v\n\n" (dict "Current" hugo.Version "Minimal" $MINIMAL_HUGO_VERSION | T "init.hugoVersionError") -}} +{{- end -}} + +{{- /* Check Hugo extend */ -}} +{{- if eq hugo.IsExtended false -}} + {{- warnf "\n\n%v\n\n" (T "init.hugoExtendedWarn") -}} +{{- end -}} + {{- /* Check for updates */ -}} {{- if $devOpts.c4u -}} {{- $url := "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" -}} diff --git a/layouts/_partials/init/index.html b/layouts/_partials/init/index.html index 5965c3e5..b5b4bf89 100644 --- a/layouts/_partials/init/index.html +++ b/layouts/_partials/init/index.html @@ -6,5 +6,4 @@ {{- partial "init/detection-deprecated.html" . -}} {{- partial "init/global.html" . -}} {{- partial "init/patch.html" . -}} - -{{- partial "plugin/compatibility.html" . -}} +{{- partial "init/compatibility.html" . -}} diff --git a/layouts/_partials/assets.html b/layouts/_partials/layout/assets.html similarity index 100% rename from layouts/_partials/assets.html rename to layouts/_partials/layout/assets.html diff --git a/layouts/_partials/breadcrumb.html b/layouts/_partials/layout/breadcrumb.html similarity index 100% rename from layouts/_partials/breadcrumb.html rename to layouts/_partials/layout/breadcrumb.html diff --git a/layouts/_partials/single/comment.html b/layouts/_partials/layout/comment.html similarity index 100% rename from layouts/_partials/single/comment.html rename to layouts/_partials/layout/comment.html diff --git a/layouts/_partials/footer.html b/layouts/_partials/layout/footer.html similarity index 100% rename from layouts/_partials/footer.html rename to layouts/_partials/layout/footer.html diff --git a/layouts/_partials/layout/head.html b/layouts/_partials/layout/head.html new file mode 100644 index 00000000..bac33a8d --- /dev/null +++ b/layouts/_partials/layout/head.html @@ -0,0 +1,318 @@ + +{{- /* + Head Partial - Comprehensive head section template + + This partial consolidates all head-related content including: + - META: Meta tags for SEO, Open Graph, Twitter Cards, and app metadata + - LINK: Favicon, canonical links, RSS feeds, and CSS stylesheet loading + - SEO: Schema.org structured data for pages and homepage + - SCRIPT: Early-loaded scripts (e.g., theme color scheme detection) + + Called from: layouts/baseof.html +*/ -}} + +{{- $fingerprint := .Site.Store.Get "fingerprint" -}} +{{- $cdn := .Site.Store.Get "cdn" | default dict -}} + +{{- /* ========== META: Meta Tags ========== */ -}} +{{- $author := partial "function/get-author-map.html" .Params.author -}} + + + + +{{- $keywords := .Keywords -}} +{{- if not $keywords -}} + {{- if .IsPage | and .Params.tags -}} + {{- $keywords = .Params.tags -}} + {{- else -}} + {{- $keywords = .Site.Params.keywords -}} + {{- end -}} +{{- end -}} +{{- with $keywords -}} + +{{- end -}} + +{{- template "_internal/schema.html" . -}} +{{- template "_internal/opengraph.html" . -}} +{{- template "_internal/twitter_cards.html" . -}} +{{- with .Site.Params.social.Twitter -}} + +{{- end -}} + + + + +{{- with .Site.Params.app.themeColor -}} + {{- $color := . -}} + {{- if ne (len $color) 2 -}} + {{- $color = dict "light" . "dark" . -}} + {{- end -}} + +{{- end -}} + +{{- with .Site.Params.app.tileColor -}} + +{{- end -}} + +{{- /* Mastodon Verification */ -}} +{{- with .Site.Params.social.Mastodon -}} + {{- $id := "" -}} + {{- $prefix := "https://mastodon.social/" -}} + {{- if reflect.IsMap . -}} + {{- $id = .Id | default .id -}} + {{- $prefix = .Prefix | default .prefix | default $prefix -}} + {{- end -}} + {{- if $id | and $prefix -}} + {{- $link := printf "%s/%s" $prefix $id -}} + {{- $email := printf "%s@%s" (strings.TrimPrefix "@" $id) (urls.Parse $prefix).Host -}} + + + {{- end -}} +{{- end -}} + +{{- /* ========== LINK: Favicon, Canonical, Feeds, Stylesheets ========== */ -}} +{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}} +{{- if .IsHome -}} + {{- $title = .Site.Title -}} +{{- end -}} + +{{- /* Favicon links */ -}} +{{- if not .Site.Params.app.noFavicon -}} + {{- $relURL := relURL "" -}} + {{- with .Site.Params.app.svgFavicon -}} + + {{- else -}} + + + + {{- end -}} + + {{- with .Site.Params.app.iconColor -}} + + {{- end -}} + {{- if eq .Site.Params.enablePWA true -}} + + {{- end -}} +{{- end -}} + +{{- /* Canonical and pagination links */ -}} + +{{- with .Prev -}} + +{{- end -}} +{{- with .Next -}} + +{{- end -}} + +{{- /* Alternative output formats (Atom, RSS, etc.) */ -}} +{{- range .AlternativeOutputFormats -}} + {{- printf `` .Rel .MediaType.Type .Permalink $title | safeHTML -}} +{{- end -}} + +{{- /* JSON Feed support */ -}} +{{- with .OutputFormats.Get "jsonfeed" -}} + +{{- end -}} + +{{- /* Core stylesheets */ -}} +{{- /* Config CSS */ -}} +{{- $options := dict "Source" "css/config.template.scss" "Template" "css/config.scss" "Fingerprint" $fingerprint -}} +{{- $toCSS := dict "targetPath" "css/config.min.css" "enableSourceMap" true -}} +{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}} +{{- partial "plugin/style.html" $options -}} + +{{- /* Theme CSS */ -}} +{{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}} +{{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}} +{{- $options = dict "Context" . "ToCSS" $toCSS | merge $options -}} +{{- partial "plugin/style.html" $options -}} + +{{- /* Font Awesome Icons */ -}} +{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}} +{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} +{{- partial "plugin/style.html" $options -}} + +{{- /* Animate.css Animation Library */ -}} +{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}} +{{- $options := dict "Source" $source "Fingerprint" $fingerprint "Preload" true -}} +{{- partial "plugin/style.html" $options -}} + +{{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}} +{{- $params := partial "function/params.html" -}} + +{{- /* Search Engine Verification */ -}} +{{- 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.so -}} + +{{- end -}} +{{- with .Site.Params.verification.sogou -}} + +{{- end -}} + +{{- /* Homepage Structured Data */ -}} +{{- if .IsHome -}} + + +{{- /* Page (Article) Structured Data */ -}} +{{- else if .IsPage -}} + {{- $authorName := .Site.Params.author.name | default (T "single.author") -}} + {{- with .Params.author -}} + {{- if reflect.IsMap . -}} + {{- $authorName = cond (isset . "name") .name $authorName -}} + {{- else -}} + {{- $authorName = . -}} + {{- end -}} + {{- end -}} + +{{- end -}} + +{{- /* ========== SCRIPT: Early-Loaded Head Scripts ========== */ -}} + +{{- /* Theme Color Scheme Detection (runs before page render) */ -}} +{{- $options := dict "targetPath" "js/head/color-scheme.min.js" "minify" hugo.IsProduction -}} +{{- $options := dict "defaultTheme" .Site.Params.defaulttheme | dict "params" | merge $options -}} +{{- if not hugo.IsProduction -}} + {{- $options = dict "sourceMap" "external" | merge $options -}} +{{- end -}} +{{- dict "Source" (resources.Get "js/head/color-scheme.js") "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}} diff --git a/layouts/_partials/header.html b/layouts/_partials/layout/header.html similarity index 100% rename from layouts/_partials/header.html rename to layouts/_partials/layout/header.html diff --git a/layouts/_partials/paginator.html b/layouts/_partials/layout/paginator.html similarity index 100% rename from layouts/_partials/paginator.html rename to layouts/_partials/layout/paginator.html diff --git a/layouts/_partials/widgets.html b/layouts/_partials/layout/widgets.html similarity index 100% rename from layouts/_partials/widgets.html rename to layouts/_partials/layout/widgets.html diff --git a/layouts/_partials/recently-updated.html b/layouts/_partials/section/recently-updated.html similarity index 100% rename from layouts/_partials/recently-updated.html rename to layouts/_partials/section/recently-updated.html diff --git a/layouts/baseof.html b/layouts/baseof.html index 853e0fd8..993eeeaa 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -11,10 +11,7 @@