GoBlog/templates/index.gohtml

34 lines
1.1 KiB
Plaintext

{{ define "title" }}
{{ if .Data.Title }}
<title>{{ .Data.Title }} - {{ .Blog.Title }}</title>
{{ else }}
<title>{{ .Blog.Title }}</title>
{{ end }}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ .Data.First }}.rss"/>
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ .Data.First }}.atom"/>
<link rel="alternate" type="application/feed+json" title="JSON Feed" 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 }}
{{ range $i, $post := .Data.Posts }}
{{ include "summary" $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 }}