Files
tplate/web/templates/header.tmpl
Hubert Chen 2ddcca3f36
All checks were successful
Build tplate / Build (push) Successful in 2m40s
sticky header and post list dynamic height
header:
    show post title in header when in a post
    header will stick to the top while scrolling
post list:
    content will auto expand the container height
2025-12-10 12:43:24 +08:00

33 lines
1.1 KiB
Cheetah

{{- define "header" }}
<header>
{{ "header" | .RenderStyle }}
<a href="/">{{ .Config.Title }}</a>
{{ if .TargetPost }}
<nav >
<div><span>{{ .TargetPost.FM.Title }}</span></div>
<div>
{{ range .Config.HeaderButtonsLeft -}}
{{ if .URL }}<a{{ if (eq .URL $.URI) }} here{{ end }} href="{{ .URL }}" {{ if .Blank }}target="_blank"{{ end }}>{{ .Text }}</a>{{ end }}
{{ end -}}
{{ range .Config.HeaderButtonsRight -}}
{{ if .URL }}<a{{ if (eq .URL $.URI) }} here{{ end }} href="{{ .URL }}" {{ if .Blank }}target="_blank"{{ end }}>{{ .Text }}</a>{{ end }}
{{ end -}}
</div>
</nav>
{{ else }}
<nav>
<div>
{{ range .Config.HeaderButtonsLeft -}}
{{ if .URL }}<a{{ if (eq .URL $.URI) }} here{{ end }} href="{{ .URL }}" {{ if .Blank }}target="_blank"{{ end }}>{{ .Text }}</a>{{ end }}
{{ end -}}
</div>
<div>
{{ range .Config.HeaderButtonsRight -}}
{{ if .URL }}<a{{ if (eq .URL $.URI) }} here{{ end }} href="{{ .URL }}" {{ if .Blank }}target="_blank"{{ end }}>{{ .Text }}</a>{{ end }}
{{ end -}}
</div>
</nav>
{{ end }}
</header>
{{- end }}