GoBlog/templates/index.gohtml

36 lines
1.4 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 class="h-feed">
{{ with .Data.Title }}<h1 class="p-name">{{ . }}</h1>{{ end }}
{{ with .Data.Description }}{{ md . }}{{ end }}
{{ if (or .Data.Title .Data.Description) }}
<hr>
{{ end }}
{{ if .Data.Posts }}
{{ $summaryTemplate := .Data.SummaryTemplate }}
{{ $rd := . }}
{{ range $i, $post := .Data.Posts }}
{{ include $summaryTemplate $rd $post }}
{{ end }}
{{ else }}
<p>{{ string .Blog.Lang "noposts" }}</p>
{{ 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 }}
{{ include "author" . }}
</main>
{{ end }}
{{ define "index" }}
{{ template "base" . }}
{{ end }}