GoBlog/templates/index.gohtml

42 lines
1.1 KiB
Plaintext

{{ define "title" }}
{{ if .Title }}
<title>{{ .Title }} - {{ (blog .Blog).Title }}</title>
{{ else }}
<title>{{ (blog .Blog).Title }}</title>
{{ end }}
<link rel="alternate"
type="application/rss+xml"
title="RSS"
href="{{ .First }}.rss"/>
<link rel="alternate"
type="application/atom+xml"
title="Atom"
href="{{ .First }}.atom"/>
<link rel="alternate"
type="application/feed+json"
title="JSON Feed"
href="{{ .First }}.json"/>
{{ end }}
{{ define "main" }}
<main>
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Description }}{{ md . }}{{ end }}
{{ if (or .Title .Description) }}
<hr>
{{ end }}
{{ range $i, $post := .Posts }}
{{ include "summary" . }}
{{ end }}
{{ if .HasPrev }}
<p><a href="{{ .Prev }}">Prev</a></p>
{{ end }}
{{ if .HasNext }}
<p><a href="{{ .Next }}">Next</a></p>
{{ end }}
</main>
{{ end }}
{{ define "index" }}
{{ template "base" . }}
{{ end }}