mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-10-10 22:09:31 +00:00
Floating glass header with ⌘K search, landing homepage layout with hero image and GitHub-stars CTA, background canvas with dissolving heroes, burufugu colour scheme, movie-quote 404, taxonomy pills, keyboard/ARIA accessibility across menus, search and tabs, idle- loaded third-party scripts, and dedicated print styles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
103 lines
3.9 KiB
HTML
103 lines
3.9 KiB
HTML
{{ $disableImageOptimization := site.Store.Get "disableImageOptimization" }}
|
|
|
|
{{ $useDefault := false }}
|
|
{{ $featured := "" }}
|
|
{{ $featuredURL := "" }}
|
|
{{ with partial "functions/feature-image.html" . }}
|
|
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
|
|
{{ if site.Params.hotlinkFeatureImage }}
|
|
{{ $featuredURL = . }}
|
|
{{ else }}
|
|
{{ $featured = resources.GetRemote . }}
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ $featured = page.Resources.Get . }}
|
|
{{ if not $featured }}
|
|
{{ $featured = resources.Get . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ if not (or $featured $featuredURL) }}
|
|
{{ $images := .Resources.ByType "image" }}
|
|
{{ range slice "*background*" "*feature*" "*cover*" "*thumbnail*" }}
|
|
{{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* When the site-wide background canvas is active it already renders the
|
|
default background image, so only fall back to it here when disabled. */}}
|
|
{{ if and (not (or $featured $featuredURL)) (not (site.Params.backgroundCanvas | default false)) }}
|
|
{{ $default := site.Store.Get "defaultBackgroundImage" }}
|
|
{{ if $default.url }}
|
|
{{ $featuredURL = $default.url }}
|
|
{{ $useDefault = true }}
|
|
{{ else if $default.obj }}
|
|
{{ $featured = $default.obj }}
|
|
{{ $useDefault = true }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{/* generate image URL if not hotlink */}}
|
|
{{ if not $featuredURL }}
|
|
{{ with $featured }}
|
|
{{ $featuredURL = .RelPermalink }}
|
|
{{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }}
|
|
{{ $size := site.Store.Get "backgroundImageWidth" }}
|
|
{{ $featuredURL = (partial "functions/resize.html" (dict "resource" . "spec" $size)).RelPermalink }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ $scope := .Scratch.Get "scope" }}
|
|
{{ $shouldBlur := $.Params.layoutBackgroundBlur | default (or
|
|
(and ($.Site.Params.article.layoutBackgroundBlur | default true) (eq $scope "single"))
|
|
(and ($.Site.Params.list.layoutBackgroundBlur | default true) (eq $scope "list"))
|
|
(and ($.Site.Params.taxonomy.layoutBackgroundBlur | default true) (eq $scope "terms"))
|
|
(and ($.Site.Params.term.layoutBackgroundBlur | default true) (eq $scope "term"))
|
|
)
|
|
}}
|
|
{{ $shouldAddHeaderSpace := $.Params.layoutBackgroundHeaderSpace | default (or
|
|
(and ($.Site.Params.article.layoutBackgroundHeaderSpace | default true) (eq $scope "single"))
|
|
(and ($.Site.Params.list.layoutBackgroundHeaderSpace | default true) (eq $scope "list"))
|
|
(and ($.Site.Params.taxonomy.layoutBackgroundHeaderSpace | default true) (eq $scope "terms"))
|
|
(and ($.Site.Params.term.layoutBackgroundHeaderSpace | default true) (eq $scope "term"))
|
|
)
|
|
}}
|
|
|
|
{{- with $featuredURL -}}
|
|
{{ if $shouldAddHeaderSpace | default true }}
|
|
<div id="hero" class="h-[150px] md:h-[200px]"></div>
|
|
{{ end }}
|
|
<div
|
|
id="hero-background"
|
|
class="hero-canvas-fade fixed inset-x-0 top-0 h-[800px] single_hero_background nozoom">
|
|
{{ $style := "" }}
|
|
{{ $defaultPosition := cond $useDefault site.Params.imagePosition false }}
|
|
{{ with $.Params.imagePosition | default $defaultPosition }}
|
|
{{ $style = printf "object-position: %s;" . }}
|
|
{{ end }}
|
|
<img
|
|
id="background-image"
|
|
src="{{ . }}"
|
|
role="presentation"
|
|
loading="eager"
|
|
decoding="async"
|
|
fetchpriority="high"
|
|
class="absolute inset-0 w-full h-full object-cover"
|
|
{{ if $style }}style="{{ $style | safeCSS }}"{{ end }} />
|
|
<div class="absolute inset-0 bg-neutral/60 dark:bg-neutral-800/50"></div>
|
|
</div>
|
|
|
|
{{ if $shouldBlur | default false }}
|
|
{{ $heroFade := resources.Get "js/hero-scroll-fade.js" }}
|
|
{{ $heroFade = $heroFade | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
|
<script
|
|
type="text/javascript"
|
|
src="{{ $heroFade.RelPermalink }}"
|
|
integrity="{{ $heroFade.Data.Integrity }}"
|
|
data-hero-id="hero-background"
|
|
data-fade-distance="500"></script>
|
|
{{ end }}
|
|
{{- end -}}
|