GoBlog/templates/index.gohtml

43 lines
1.2 KiB
Plaintext
Raw Normal View History

2020-08-05 17:14:10 +00:00
{{ define "title" }}
2020-10-12 16:47:23 +00:00
{{ if .Data.Title }}
<title>{{ .Data.Title }} - {{ .Blog.Title }}</title>
2020-09-21 16:03:05 +00:00
{{ else }}
2020-10-12 16:47:23 +00:00
<title>{{ .Blog.Title }}</title>
2020-09-21 16:03:05 +00:00
{{ end }}
<link rel="alternate"
type="application/rss+xml"
title="RSS"
2020-10-12 16:47:23 +00:00
href="{{ .Data.First }}.rss"/>
2020-09-21 16:03:05 +00:00
<link rel="alternate"
type="application/atom+xml"
title="Atom"
2020-10-12 16:47:23 +00:00
href="{{ .Data.First }}.atom"/>
2020-09-21 16:03:05 +00:00
<link rel="alternate"
type="application/feed+json"
title="JSON Feed"
2020-10-12 16:47:23 +00:00
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 }}
{{ range $i, $post := .Data.Posts }}
{{ include "summary" $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 }}