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
|
Posts []*Post
|
||||||
HasPrev bool
|
HasPrev bool
|
||||||
HasNext bool
|
HasNext bool
|
||||||
|
First string
|
||||||
Prev string
|
Prev string
|
||||||
Next string
|
Next string
|
||||||
}
|
}
|
||||||
|
@ -162,6 +163,7 @@ func serveIndex(path string, sec *section, tax *taxonomy, taxonomyValue string)
|
||||||
Posts: posts,
|
Posts: posts,
|
||||||
HasPrev: p.HasPrev(),
|
HasPrev: p.HasPrev(),
|
||||||
HasNext: p.HasNext(),
|
HasNext: p.HasNext(),
|
||||||
|
First: path,
|
||||||
Prev: fmt.Sprintf("%s/page/%d", path, prevPage),
|
Prev: fmt.Sprintf("%s/page/%d", path, prevPage),
|
||||||
Next: fmt.Sprintf("%s/page/%d", path, nextPage),
|
Next: fmt.Sprintf("%s/page/%d", path, nextPage),
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,12 +1,26 @@
|
||||||
{{ define "title" }}
|
{{ define "title" }}
|
||||||
<title>{{ blog.Title }}</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 }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<main>
|
<main>
|
||||||
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
|
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
|
||||||
{{ with .Description }}{{ md . }}{{ end }}
|
{{ with .Description }}{{ md . }}{{ end }}
|
||||||
{{ if (or .Title .Description) }}<hr>{{ end }}
|
{{ if (or .Title .Description) }}
|
||||||
|
<hr>
|
||||||
|
{{ end }}
|
||||||
{{ range $i, $post := .Posts }}
|
{{ range $i, $post := .Posts }}
|
||||||
{{ include "summary" . }}
|
{{ include "summary" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue