hugo-wasm/docs/layouts/_default/single.html
2025-02-13 10:40:34 +01:00

71 lines
2.4 KiB
HTML

{{ define "main" }}
{{ $ttop := debug.Timer "single" }}
<article class="max-w-5xl lg:max-w-3xl">
{{ partial "layouts/docsheader.html" . }}
<div class="content" id="content">
{{ with .Params.description }}
<div class="lead">
{{ . | markdownify }}
</div>
{{ end }}
{{ $t := debug.Timer "single.categories" }}
{{ $categories := .GetTerms "categories" }}
{{ with $categories }}
<div class="mb-4 sm:mb-6 flex flex-wrap gap-2">
{{ range . }}
{{ $text := .LinkTitle }}
{{ $class := "" }}
{{ range (slice true false ) }}
{{ $color := partial "helpers/funcs/color-from-string.html" (dict "text" $text "dark" . "--single" "green" ) }}
{{ $prefix := "" }}
{{ if . }}
{{ $prefix = "dark:" }}
{{ end }}
{{ $class = printf "%sbg-%s-%d %stext-%s-%d border %sborder-%s-%d"
$prefix $color.color $color.shade1
$prefix $color.color $color.shade2
$prefix $color.color $color.shade3
}}
{{ end }}
<a
href="{{ .RelPermalink }}"
class="{{ $class }} text-xs h-auto tracking-widest uppercase font-light not-prose no-underline inline-block py-1 px-3 rounded-xl shadow-xs hover:opacity-80 hover:shadow-none">
{{ .LinkTitle }}
</a>
{{ end }}
</div>
{{ end }}
{{ $t.Stop }}
{{ if .Params.action.signatures }}
<div class="mb-4 not-prose">
{{- partial "docs/functions-signatures.html" . -}}
{{- partial "docs/functions-return-type.html" . -}}
{{- partial "docs/functions-aliases.html" . -}}
</div>
{{ end }}
{{ $t := debug.Timer "single.content" }}
{{ .Content }}
{{ $t.Stop }}
{{ $t := debug.Timer "single.page-edit" }}
{{ partial "layouts/page-edit.html" . }}
{{ $t.Stop }}
</div>
</article>
{{ $ttop.Stop }}
{{ end }}
{{ define "rightsidebar_content" }}
{{/* in-this-section.html depends on these being reneredc first. */}}
{{ $related := partial "layouts/related.html" . }}
{{ $toc := partial "layouts/toc.html" . }}
{{ if not .Params.hide_in_this_section }}
{{ partial "layouts/in-this-section.html" . }}
{{ end }}
{{ $related }}
{{ $toc }}
{{ end }}