GoBlog/templates/index.gohtml

31 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-08-05 17:14:10 +00:00
{{ define "title" }}
2020-11-15 16:26:46 +00:00
<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"/>
2020-08-05 17:14:10 +00:00
{{ end }}
{{ define "main" }}
<main>
2020-10-12 16:47:23 +00:00
{{ with .Data.Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Data.Description }}{{ md . }}{{ end }}
{{ if (or .Data.Title .Data.Description) }}
2020-09-02 15:56:18 +00:00
<hr>
{{ end }}
2020-10-12 16:47:23 +00:00
{{ $blog := .Blog }}
{{ $summaryTemplate := .Data.SummaryTemplate }}
2020-10-12 16:47:23 +00:00
{{ range $i, $post := .Data.Posts }}
{{ include $summaryTemplate $blog $post }}
2020-08-05 17:54:04 +00:00
{{ end }}
2020-10-12 16:47:23 +00:00
{{ if .Data.HasPrev }}
2020-10-12 17:12:43 +00:00
<p><a href="{{ .Data.Prev }}">{{ string .Blog.Lang "prev" }}</a></p>
2020-08-05 17:54:04 +00:00
{{ end }}
2020-10-12 16:47:23 +00:00
{{ if .Data.HasNext }}
2020-10-12 17:12:43 +00:00
<p><a href="{{ .Data.Next }}">{{ string .Blog.Lang "next" }}</a></p>
2020-08-05 17:54:04 +00:00
{{ end }}
2020-08-05 17:14:10 +00:00
</main>
{{ end }}
{{ define "index" }}
{{ template "base" . }}
{{ end }}