GoBlog/templates/index.gohtml

31 lines
1.2 KiB
Plaintext

{{ define "title" }}
<title>{{ with .Data.Title }}{{ . }} - {{ end }}{{ .Blog.Title }}</title>
<link rel="alternate" type="application/rss+xml" title="RSS{{ with .Data.Title }} ({{ . }}){{ end }}" href="{{ .Data.First }}.rss"/>
<link rel="alternate" type="application/atom+xml" title="Atom{{ with .Data.Title }} ({{ . }}){{ end }}" href="{{ .Data.First }}.atom"/>
<link rel="alternate" type="application/feed+json" title="JSON Feed{{ with .Data.Title }} ({{ . }}){{ end }}" href="{{ .Data.First }}.json"/>
{{ end }}
{{ define "main" }}
<main>
{{ with .Data.Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Data.Description }}{{ md . }}{{ end }}
{{ if (or .Data.Title .Data.Description) }}
<hr>
{{ end }}
{{ $blog := .Blog }}
{{ $summaryTemplate := .Data.SummaryTemplate }}
{{ range $i, $post := .Data.Posts }}
{{ include $summaryTemplate $blog $post }}
{{ end }}
{{ if .Data.HasPrev }}
<p><a href="{{ .Data.Prev }}">{{ string .Blog.Lang "prev" }}</a></p>
{{ end }}
{{ if .Data.HasNext }}
<p><a href="{{ .Data.Next }}">{{ string .Blog.Lang "next" }}</a></p>
{{ end }}
</main>
{{ end }}
{{ define "index" }}
{{ template "base" . }}
{{ end }}