mirror of https://github.com/jlelse/GoBlog
Index template: Link to feeds in head
This commit is contained in:
parent
341d9ab3f5
commit
e1a77bf48a
2
posts.go
2
posts.go
|
@ -53,6 +53,7 @@ type indexTemplateData struct {
|
|||
Posts []*Post
|
||||
HasPrev bool
|
||||
HasNext bool
|
||||
First string
|
||||
Prev string
|
||||
Next string
|
||||
}
|
||||
|
@ -162,6 +163,7 @@ func serveIndex(path string, sec *section, tax *taxonomy, taxonomyValue string)
|
|||
Posts: posts,
|
||||
HasPrev: p.HasPrev(),
|
||||
HasNext: p.HasNext(),
|
||||
First: path,
|
||||
Prev: fmt.Sprintf("%s/page/%d", path, prevPage),
|
||||
Next: fmt.Sprintf("%s/page/%d", path, nextPage),
|
||||
})
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
{{ define "title" }}
|
||||
<title>{{ blog.Title }}</title>
|
||||
<link rel="alternate"
|
||||
type="application/rss+xml"
|
||||
title="RSS"
|
||||
href="{{ .First }}?feed=rss"/>
|
||||
<link rel="alternate"
|
||||
type="application/atom+xml"
|
||||
title="Atom"
|
||||
href="{{ .First }}?feed=atom"/>
|
||||
<link rel="alternate"
|
||||
type="application/feed+json"
|
||||
title="JSON Feed"
|
||||
href="{{ .First }}?feed=json"/>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
|
||||
{{ with .Description }}{{ md . }}{{ end }}
|
||||
{{ if (or .Title .Description) }}<hr>{{ end }}
|
||||
{{ if (or .Title .Description) }}
|
||||
<hr>
|
||||
{{ end }}
|
||||
{{ range $i, $post := .Posts }}
|
||||
{{ include "summary" . }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue