{{- if or (eq .Kind "404") .Params.robotsNoIndex }} {{- else if hugo.IsProduction | or (eq site.Params.env "production") }} {{- else }} {{- end }} {{- /* Title */}} {{- $shortTitle := site.Params.shortTitle | default site.Title -}} {{- $baseTitle := .Title -}} {{- if hasPrefix .Title "http" -}}{{- $baseTitle = cond .Parent .Parent.Title site.Title -}}{{- end -}} {{- $pagerSuffix := "" -}} {{- if and (not .IsPage) .Paginator (gt .Paginator.PageNumber 1) -}} {{- if eq .Language.Lang "zh" -}} {{- $pagerSuffix = printf " - 第 %d 页" .Paginator.PageNumber -}} {{- else -}} {{- $pagerSuffix = printf " - Page %d" .Paginator.PageNumber -}} {{- end -}} {{- end -}} {{- $titleCore := cond (gt (len $baseTitle) 50) (printf "%s…" (substr $baseTitle 0 50)) $baseTitle -}} {{- $pageTitle := cond .IsHome site.Title (printf "%s%s | %s" $titleCore $pagerSuffix $shortTitle) -}} {{ $pageTitle }} {{- partial "seo.html" . -}} {{- if site.Params.analytics.google.SiteVerificationTag }} {{- end }} {{- if site.Params.analytics.yandex.SiteVerificationTag }} {{- end }} {{- if site.Params.analytics.bing.SiteVerificationTag }} {{- end }} {{- if site.Params.analytics.naver.SiteVerificationTag }} {{- end }} {{- /* Styles */}} {{- /* includes */}} {{- $includes := slice }} {{- $includes = $includes | append (" " | resources.FromString "assets/css/includes-blank.css")}} {{- if not (eq site.Params.assets.disableScrollBarStyle true) }} {{- $ScrollStyle := (resources.Get "css/includes/scroll-bar.css") }} {{- $includes = (append $ScrollStyle $includes) }} {{- end }} {{- $includes_all := $includes | resources.Concat "assets/css/includes.css" }} {{- $theme_vars := (resources.Get "css/core/theme-vars.css") }} {{- $reset := (resources.Get "css/core/reset.css") }} {{- $media := (resources.Get "css/core/zmedia.css") }} {{- $license_css := (resources.Get "css/core/license.css") }} {{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }} {{- /* include `an-old-hope` if hljs is on */}} {{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default false) }} {{- $hljs := (cond ($isHLJSdisabled) (".chroma { background-color: unset !important;}" | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }} {{- /* order is important */}} {{- $core := (slice $theme_vars $reset $common $hljs $includes_all $media) | resources.Concat "assets/css/core.css" | resources.Minify }} {{- /* homepage-daypage.css (~52 KB) is homepage-only — keep it out of the site-wide bundle and load it separately on the home pages below. */}} {{- $homepageCSS := resources.Get "css/extended/homepage-daypage.css" }} {{- $extendedFiles := collections.Complement (slice $homepageCSS) (resources.Match "css/extended/*.css") }} {{- $extended := $extendedFiles | resources.Concat "assets/css/extended.css" | resources.Minify }} {{- /* bundle all required css */}} {{- /* Add extended css after theme style */ -}} {{- $stylesheet := (slice $license_css $core $extended) | resources.Concat "assets/css/stylesheet.css" }} {{- if not site.Params.assets.disableFingerprinting }} {{- $stylesheet := $stylesheet | fingerprint }} {{- else }} {{- end }} {{- /* Homepage-only DayPage stylesheet (split out of the global bundle above). Loaded after it, so its rules keep the same cascade priority they had when concatenated. */}} {{- if .IsHome }} {{- $hp := $homepageCSS | resources.Minify }} {{- if not site.Params.assets.disableFingerprinting }} {{- $hp = $hp | fingerprint }} {{- else }} {{- end }} {{- end }} {{- /* Search */}} {{- if (eq .Layout `search`) -}} {{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" site.Params.fuseOpts)) | resources.Minify }} {{- $fusejs := resources.Get "js/fuse.basic.min.js" }} {{- $license_js := resources.Get "js/license.js" }} {{- if not site.Params.assets.disableFingerprinting }} {{- $search := (slice $fusejs $license_js $fastsearch ) | resources.Concat "assets/js/search.js" | fingerprint }} {{- else }} {{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" }} {{- end }} {{- end -}} {{- /* Highlight.js */}} {{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} {{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} {{- if not site.Params.assets.disableFingerprinting }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | fingerprint }} {{- else }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" }} {{- end }} {{- end }} {{- /* Favicons */}} {{- /* RSS */}} {{ range .AlternativeOutputFormats -}} {{ end -}} {{- /* hreflang: emit one per translation of this page (Hugo's AllTranslations includes the current page since v0.62), plus an explicit x-default pointing at the default-language version (DefaultContentLanguage — currently "en"; .Sites is ordered by language weight, so the first entry is the default). Fall back to the current page's own permalink if a default-lang version doesn't exist for this page. */ -}} {{- $defaultLang := (index .Sites 0).Language.Lang -}} {{- $defaultURL := .Permalink -}} {{- range .AllTranslations -}} {{ if eq .Lang $defaultLang -}}{{- $defaultURL = .Permalink -}}{{- end -}} {{ end -}} {{- partial "extend_head.html" . -}} {{- /* Auto Language Detection */}} {{- partial "auto-language.html" . }} {{- /* Misc */}} {{- if hugo.IsProduction | or (eq site.Params.env "production") }} {{- /* Lazy-load Google Analytics after first user interaction to avoid 465KB payload on initial load */}} {{- $gaID := site.Config.Services.GoogleAnalytics.ID | default site.Params.googleAnalytics | default "" -}} {{- if $gaID }} {{- end }} {{- /* OG/Twitter/Schema covered by seo.html and seo/structured-data.html */ -}} {{- end -}}