Skip to content
klacke edited this page Sep 13, 2010 · 1 revision

Here is a good example on how to get started with RSS feeds:

http://wiki.trapexit.org/index.php/How_to_setup_an_RSS_feed_with_Yaws

I made a few changes that I found in another site that seems to have made a difference. In the above example, change rss.yaws to look like this: (notice that the content type is injected in the out/1.)

<erl>
out(A) ->
    case yaws_rss:retrieve(test, xml) of
        {ok, Xml} ->
            {content, "application/rss+xml", head()++Xml++tail()};
        _ ->
            {content, "text/xml", ""}
    end.

head() ->
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
 <rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">
  <channel>
    <title>Exampel RSS feed</title>
    <link>http://www.blaha.org/</link>
    <description>
     Bla bla....
    </description>
    <language>en</language>".

tail() ->
"  </channel>
    </rss>".

</erl>

NOTE: when testing against a local DEV machine and using a Safari client. You should add an FQDN entry in your /etc/hosts table because Safari seems to look for the FQDN. Without it it will appear to malfunction. FireFox will work either way.

Clone this wiki locally