GoBlog/templates/index.gohtml

36 lines
1.4 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" }}
2020-12-23 16:42:12 +00:00
<main class="h-feed">
{{ with .Data.Title }}<h1 class="p-name">{{ . }}</h1>{{ end }}
2020-10-12 16:47:23 +00:00
{{ with .Data.Description }}{{ md . }}{{ end }}
{{ if (or .Data.Title .Data.Description) }}
2020-09-02 15:56:18 +00:00
<hr>
{{ end }}
2021-03-08 17:14:52 +00:00
{{ if .Data.Posts }}
{{ $summaryTemplate := .Data.SummaryTemplate }}
2021-03-10 18:21:23 +00:00
{{ $rd := . }}
2021-03-08 17:14:52 +00:00
{{ range $i, $post := .Data.Posts }}
2021-03-10 18:21:23 +00:00
{{ include $summaryTemplate $rd $post }}
2021-03-08 17:14:52 +00:00
{{ end }}
{{ else }}
<p>{{ string .Blog.Lang "noposts" }}</p>
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-12-23 16:42:12 +00:00
{{ include "author" . }}
2020-08-05 17:14:10 +00:00
</main>
{{ end }}
{{ define "index" }}
{{ template "base" . }}
{{ end }}