## gorilla/feeds
[![GoDoc](https://godoc.org/github.com/gorilla/feeds?status.svg)](https://godoc.org/github.com/gorilla/feeds)
feeds is a web feed generator library for generating RSS, Atom and JSON feeds from Go
applications.
### Goals
* Provide a simple interface to create both Atom & RSS 2.0 feeds
* Full support for [Atom][atom], [RSS 2.0][rss], and [JSON Feed Version 1][jsonfeed] spec elements
* Ability to modify particulars for each spec
[atom]: https://tools.ietf.org/html/rfc4287
[rss]: http://www.rssboard.org/rss-specification
[jsonfeed]: https://jsonfeed.org/version/1
### Usage
```go
package main
import (
"fmt"
"log"
"time"
"github.com/gorilla/feeds"
)
func main() {
now := time.Now()
feed := &feeds.Feed{
Title: "jmoiron.net blog",
Link: &feeds.Link{Href: "http://jmoiron.net/blog"},
Description: "discussion about tech, footie, photos",
Author: &feeds.Author{Name: "Jason Moiron", Email: "jmoiron@jmoiron.net"},
Created: now,
}
feed.Items = []*feeds.Item{
&feeds.Item{
Title: "Limiting Concurrency in Go",
Link: &feeds.Link{Href: "http://jmoiron.net/blog/limiting-concurrency-in-go/"},
Description: "A discussion on controlled parallelism in golang",
Author: &feeds.Author{Name: "Jason Moiron", Email: "jmoiron@jmoiron.net"},
Created: now,
},
&feeds.Item{
Title: "Logic-less Template Redux",
Link: &feeds.Link{Href: "http://jmoiron.net/blog/logicless-template-redux/"},
Description: "More thoughts on logicless templates",
Created: now,
},
&feeds.Item{
Title: "Idiomatic Code Reuse in Go",
Link: &feeds.Link{Href: "http://jmoiron.net/blog/idiomatic-code-reuse-in-go/"},
Description: "How to use interfaces effectively",
Created: now,
},
}
atom, err := feed.ToAtom()
if err != nil {
log.Fatal(err)
}
rss, err := feed.ToRss()
if err != nil {
log.Fatal(err)
}
json, err := feed.ToJSON()
if err != nil {
log.Fatal(err)
}
fmt.Println(atom, "\n", rss, "\n", json)
}
```
Outputs:
```xml
jmoiron.net blog
http://jmoiron.net/blog
2013-01-16T03:26:01-05:00
discussion about tech, footie, photos
Limiting Concurrency in Go
2013-01-16T03:26:01-05:00
tag:jmoiron.net,2013-01-16:/blog/limiting-concurrency-in-go/
A discussion on controlled parallelism in golang
Jason Moiron
jmoiron@jmoiron.net
Logic-less Template Redux
2013-01-16T03:26:01-05:00
tag:jmoiron.net,2013-01-16:/blog/logicless-template-redux/
More thoughts on logicless templates
Idiomatic Code Reuse in Go
2013-01-16T03:26:01-05:00
tag:jmoiron.net,2013-01-16:/blog/idiomatic-code-reuse-in-go/
How to use interfaces <em>effectively</em>
jmoiron.net blog
http://jmoiron.net/blog
discussion about tech, footie, photos
jmoiron@jmoiron.net (Jason Moiron)
2013-01-16T03:22:24-05:00
-
Limiting Concurrency in Go
http://jmoiron.net/blog/limiting-concurrency-in-go/
A discussion on controlled parallelism in golang
2013-01-16T03:22:24-05:00
-
Logic-less Template Redux
http://jmoiron.net/blog/logicless-template-redux/
More thoughts on logicless templates
2013-01-16T03:22:24-05:00
-
Idiomatic Code Reuse in Go
http://jmoiron.net/blog/idiomatic-code-reuse-in-go/
How to use interfaces <em>effectively</em>
2013-01-16T03:22:24-05:00
{
"version": "https://jsonfeed.org/version/1",
"title": "jmoiron.net blog",
"home_page_url": "http://jmoiron.net/blog",
"description": "discussion about tech, footie, photos",
"author": {
"name": "Jason Moiron"
},
"items": [
{
"id": "",
"url": "http://jmoiron.net/blog/limiting-concurrency-in-go/",
"title": "Limiting Concurrency in Go",
"summary": "A discussion on controlled parallelism in golang",
"date_published": "2013-01-16T03:22:24.530817846-05:00",
"author": {
"name": "Jason Moiron"
}
},
{
"id": "",
"url": "http://jmoiron.net/blog/logicless-template-redux/",
"title": "Logic-less Template Redux",
"summary": "More thoughts on logicless templates",
"date_published": "2013-01-16T03:22:24.530817846-05:00"
},
{
"id": "",
"url": "http://jmoiron.net/blog/idiomatic-code-reuse-in-go/",
"title": "Idiomatic Code Reuse in Go",
"summary": "How to use interfaces \u003cem\u003eeffectively\u003c/em\u003e",
"date_published": "2013-01-16T03:22:24.530817846-05:00"
}
]
}
```