Add rss feed for the news

This commit is contained in:
Las Zenow 2013-08-31 02:45:30 +02:00
parent 0f81282ad9
commit eb8acc8a5b
4 changed files with 39 additions and 3 deletions

View file

@ -1,6 +1,8 @@
{{template "header.html" .S}}
<h4>News:</h4>
<h4>News:
<a href="/news/?fmt=rss" class="pull-right"><img src="/img/feed.png"/></a>
</h4>
<dl class="dl-horizontal">
{{range .News}}

20
templates/news_rss.xml Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
{{with .S}}
<title>Imperial Library of Trantor - News</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>