1
0
Fork 0
hugo-paper/layouts/_default/baseof.html
2022-12-27 02:48:49 +08:00

51 lines
1.6 KiB
HTML

<!DOCTYPE html>
{{ $.Scratch.Delete "bg_color" }}<!---->
{{ $.Scratch.Delete "social_list" }}<!---->
{{ $.Scratch.Delete "avatar_url" }}<!---->
<!-- bg_color -->
{{ $color_map := dict "linen" "#faf6f1" "wheat" "#f1efe1" "gray" "#fbfbfb"
"light" "#fff" }}<!---->
{{ $.Scratch.Set "bg_color" (index $color_map (site.Params.color | default
(print "linen"))) }}<!---->
<!-- social_list -->
{{ $social_params := slice "twitter" "github" "instagram" "mastodon" "rss" }}<!---->
{{ range $social_params }}<!---->
{{ if isset site.Params . }}<!---->
{{ $.Scratch.Add "social_list" (slice .) }}<!---->
{{ end }}<!---->
{{ end }}<!---->
<!-- avatar_url -->
{{ if site.Params.avatar }}<!---->
{{ if in site.Params.avatar "http" }}<!---->
{{ $.Scratch.Set "avatar_url" site.Params.avatar }}<!---->
{{ else }}<!---->
{{ $official_cdn := "https://www.gravatar.com/avatar/" }}<!---->
{{ $cdn := (site.Params.gravatarCdn | default $official_cdn) }}<!---->
{{ $md5 := (md5 site.Params.avatar) }}<!---->
{{ $avatar_url := print $cdn $md5 "?s=160&d=identicon" }}<!---->
{{ $.Scratch.Set "avatar_url" $avatar_url }}<!---->
{{ end }}<!---->
{{ end }}<!---->
<html
class="not-ready text-sm lg:text-base"
style="--bg: {{ $.Scratch.Get `bg_color` }}"
lang="{{ site.LanguageCode }}"
>
{{ partial "head.html" . }}
<body class="text-black duration-200 ease-out dark:text-white">
{{ partial "header.html" . }}
<main
class="prose prose-neutral relative mx-auto min-h-[calc(100%-10rem)] max-w-3xl px-8 pt-20 pb-32 dark:prose-invert"
>
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}
</body>
</html>