{{define "layout"}} {{block "title" .}}{{.Blog.Title}}{{end}} {{if .Data.theme.Favicon}} {{else}} {{end}} {{$l := .Data.layout}} {{if or $l.Header .Data.theme.HeaderImage}}{{if .Data.theme.HeaderOn}}{{end}}{{end}}
{{$n := .Data.notices}}
{{template "notices" (index $n "main-top")}} {{range $l.Above}}{{template "module" (dict "m" . "root" $)}}{{end}} {{template "content" .}} {{range $l.Below}}{{template "module" (dict "m" . "root" $)}}{{end}} {{template "notices" (index $n "main-bottom")}}
{{if $l.HasLeft}}
{{template "notices" (index $n "left-top")}} {{range $l.Left}}{{template "module" (dict "m" . "root" $)}}{{end}} {{template "notices" (index $n "left-bottom")}}
{{end}} {{if $l.HasRight}}
{{template "notices" (index $n "right-top")}} {{range $l.Right}}{{template "module" (dict "m" . "root" $)}}{{end}} {{template "notices" (index $n "right-bottom")}}
{{end}}
{{if $l.Footer}}{{end}} {{end}} {{define "notices"}}{{if .}}
{{range .}} {{end}}
{{end}}{{end}} {{/* One layout module. .m is the store.Module, .root the page data; the same kind renders differently in the header (big blocks) and elsewhere (boxes). */}} {{define "module"}}{{$m := .m}}{{$r := .root}}{{$t := $r.Data.theme}}{{$rc := $t.RuleClass}} {{- if eq $m.Kind "title"}}
{{template "rule" (dict "before" true "rc" $rc "theme" $t)}}

{{$r.Blog.Title}}

{{if $r.Blog.Tagline}}

{{$r.Blog.Tagline}}

{{end}}
{{template "rule" (dict "before" false "rc" $rc "theme" $t)}}
{{- else if eq $m.Kind "logo"}}{{if $t.Logo}}{{if eq $m.Area "header"}}
{{template "rule" (dict "before" true "rc" $rc "theme" $t)}}
{{template "rule" (dict "before" false "rc" $rc "theme" $t)}}
{{else}}{{end}}{{end}} {{- else if eq $m.Kind "menu"}}{{if eq $m.Area "header"}} {{else}}{{end}} {{- else if eq $m.Kind "recent"}}
{{template "modtitle" $m}}
{{- else if eq $m.Kind "archive"}}
{{template "modtitle" $m}} {{range $i, $y := $r.Data.archive}}{{$y.Year}} ({{$y.Count}}) {{range $y.Months}}
{{month .Month}} ({{len .Posts}})
{{end}} {{else}}

{{t "No posts yet."}}

{{end}}
{{- else if eq $m.Kind "tags"}}
{{template "modtitle" $m}}
{{- else if eq $m.Kind "tagcloud"}}
{{template "modtitle" $m}}

{{range $r.Data.tagcloud}}{{if $r.Data.theme.TagHash}}#{{end}}{{.Name}} {{else}}{{t "No tags yet."}}{{end}}

{{- else if eq $m.Kind "search"}}{{if eq $m.Area "header"}}{{if not $r.Data.layout.HeaderMenu}}{{end}} {{else}}{{end}} {{- else if eq $m.Kind "html"}}{{if not $m.Body}}{{else if or (eq $m.Area "above") (eq $m.Area "below")}}
{{html $m.Body}}
{{else}}
{{template "modtitle" $m}}{{html $m.Body}}
{{end}} {{- else if eq $m.Kind "rss"}}

{{t "RSS feed"}}

{{- else if eq $m.Kind "text"}}{{if $m.Body}}
{{range split $m.Body "\n"}}{{if .}}

{{.}}

{{end}}{{end}}
{{end}} {{- else if eq $m.Kind "sitemap"}}
{{template "modtitle" $m}}
{{- end}}{{end}} {{/* The search box: a plain GET form, so it works without JavaScript. Just the input — Enter (or the phone keyboard's search key) submits a one-field form everywhere, and the placeholder is the label, so the page does not say "Search" over and over. .Data.q only exists on the search page. */}} {{define "searchform"}}
{{end}} {{/* The header rule beside a title or logo block: after it, and before it too when the header is centred. Nothing without a rule (.rc is empty). */}} {{define "rule"}}{{if .rc}}{{if or (not .before) (eq .theme.HeaderAlign "center")}}
{{end}}{{end}}{{end}} {{define "modtitle"}}{{if .Title}}

{{.Title}}

{{end}}{{end}} {{define "menulinks"}}{{range .Data.menu}}{{.Text}} {{end}}{{end}}