Use xml marshaling to create the rss feed
This commit is contained in:
parent
04c452853a
commit
0637cb7602
7 changed files with 159 additions and 82 deletions
|
@ -1,17 +0,0 @@
|
|||
{{$baseURL := .BaseURL}}
|
||||
{{range .Books}}
|
||||
<item>
|
||||
<title>{{.Title}} - {{index .Authors 0}}</title>
|
||||
<description>{{.Description}}</description>
|
||||
<link>{{$baseURL}}/book/{{.ID}}</link>
|
||||
{{if .Isbn}}
|
||||
<guid isPermaLink="false">ISBN: {{.Isbn}}</guid>
|
||||
{{end}}
|
||||
<enclosure url="{{$baseURL}}/download/{{.ID}}/{{.Title}}.epub" length="{{.FileSize}}" type="application/epub+zip" />
|
||||
{{range .Authors}}
|
||||
{{if .}}
|
||||
<category>{{.}}</category>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</item>
|
||||
{{end}}
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>{{.S.Title}}</title>
|
||||
<description>{{range .List.Description}}
|
||||
{{.}}
|
||||
{{end}}</description>
|
||||
<link>{{.S.BaseURL}}/list/{{.List.ListID}}</link>
|
||||
<managingEditor>{{.List.User.Username}}</managingEditor>
|
||||
|
||||
{{template "book_list.rss" book_list .List.Books .S.BaseURL}}
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
{{with .S}}
|
||||
<title>{{.Title}}</title>
|
||||
<description>News of the library</description>
|
||||
<link>{{.BaseURL}}/news/</link>
|
||||
{{end}}
|
||||
|
||||
{{$baseURL := .S.BaseURL}}
|
||||
{{range .News}}
|
||||
<item>
|
||||
<title>{{.Date}}</title>
|
||||
<description>{{.Text}}</description>
|
||||
<link>{{$baseURL}}/news/</link>
|
||||
</item>
|
||||
{{end}}
|
||||
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
{{with .S}}
|
||||
<title>{{.Title}}</title>
|
||||
{{if .Search}}
|
||||
<description>Book search: {{.Search}}</description>
|
||||
{{else}}
|
||||
<description>Last books added</description>
|
||||
{{end}}
|
||||
<link>{{.BaseURL}}</link>
|
||||
{{end}}
|
||||
|
||||
{{template "book_list.rss" book_list .Books .S.BaseURL}}
|
||||
|
||||
</channel>
|
||||
</rss>
|
Reference in a new issue