diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2021-02-21 21:11:14 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2021-02-21 21:11:14 +0100 |
commit | 825c253494a4930780e90dafa0a91ffed6debc08 (patch) | |
tree | 002e338da1e82b8cfaf1cd2f2d6c80ffca45604c | |
parent | 3dc7cf64535a1072d0aa029f4a247dbed4d31fee (diff) | |
download | fbfeed-825c253494a4930780e90dafa0a91ffed6debc08.tar.gz fbfeed-825c253494a4930780e90dafa0a91ffed6debc08.tar.bz2 fbfeed-825c253494a4930780e90dafa0a91ffed6debc08.zip |
Add RSS link in HTML footer.
-rw-r--r-- | main.go | 5 | ||||
-rw-r--r-- | templates.go | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -12,6 +12,7 @@ var outputMode string type channel struct { Title string Link string + Name string Description string Items []*post } @@ -29,6 +30,8 @@ func (c *channel) String() string { s = strings.Replace(template, "{{title}}", c.Title, -1) s = strings.Replace(s, "{{link}}", c.Link, -1) s = strings.Replace(s, "{{description}}", c.Description, -1) + s = strings.Replace(s, "{{name}}", c.Name, -1) + var items string for i := range c.Items { item := c.Items[i].String() @@ -81,6 +84,8 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + c.Name = group + fmt.Fprintf(w, "%s\n", c.String()) } diff --git a/templates.go b/templates.go index 5168c1a..0537f7c 100644 --- a/templates.go +++ b/templates.go @@ -63,7 +63,7 @@ const htmlRoot = ` </main> <hr> <footer> - <small>Generated by fbfeed</small> + <small>Generated by fbfeed · <a href="/{{name}}.rss">rss feed</a></small> </footer> </body> |