Skip to content

Instantly share code, notes, and snippets.

@MaxwellBo
Forked from crudh/PlayRss.scala
Created July 6, 2017 23:24
Show Gist options
  • Save MaxwellBo/11f57f150736d9e37efe19ba74556bdd to your computer and use it in GitHub Desktop.
Save MaxwellBo/11f57f150736d9e37efe19ba74556bdd to your computer and use it in GitHub Desktop.
Scala/Play RSS example
def rss = Action { implicit request =>
Ok(
<rss version="2.0">
<channel>
<title>News Application</title>
<link>{ routes.Application.index.absoluteURL(false) }</link>
<description>News Application</description>
{ NewsArticle.all.map { newsArticle =>
<item>
<title>{ newsArticle.title }</title>
<link>{ routes.News.article(newsArticle.id).absoluteURL(false) }</link>
<description>{ newsArticle.text }</description>
</item>
}}
</channel>
</rss>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment