Metadata properties for CFFEED

When creating RSS feeds with the CFFEED tag, you can specify metadata properties for the feed that help describe the feed in general. The docs though aren’t very clear on what metadata properties you can provide. The docs say that for RSS 2.0 feeds the title, link, description, and version properties are required, but all others are optional. What others? I was never able to find documentation that describes what fields you can use. At the same time though CFFEED is smart enough to recognize valid fields. If you pass a field named “ray” for example, it ignores it when creating the feed. So what is available? I did some Googling and I found a specification for RSS 2:

RSS 2.0 at Harvard Law

The docs here listed a bunch of items all of which worked. In general they were all simple to use. For example, here was my initial metadata based on what I had to pass:

<!--- Struct to contain metadata ---> <cfset meta = structNew()> <cfset meta.title = "Orange Whip Studio Films"> <cfset meta.link = "http://localhost/ows"> <cfset meta.description = "Latest Films">

Next I added additional fields:

<cfset meta.language = "Klingon"> <cfset meta.copyright = "I own you."> <cfset meta.managingEditor = "ray@camdenfamily.com"> <cfset meta.webmaster = "ray@camdenfamily.com"> <cfset meta.pubDate = now()> <cfset meta.lastBuildDate = now()>

This worked fine until I hit categories. Categories have been an array of a structs:

<cfset meta.category = []> <cfset meta.category[1] = structNew()> <cfset meta.category[1].value = "Boogers">

Why? Because categories support an optional domain field. To supply the domain just add it as a key:

<cfset meta.category = []> <cfset meta.category[1] = structNew()> <cfset meta.category[1].domain = "foo"> <cfset meta.category[1].value = "Boogers">

Another complex value is the cloud key. This takes 5 subkeys:

<cfset meta.cloud = structNew()> <cfset meta.cloud.domain ="rpc.sys.com"> <cfset meta.cloud.port = "80"> <cfset meta.cloud.path = "/rpc2"> <cfset meta.cloud.registerProcedure="pingMe"> <cfset meta.cloud.protocol = "soap">

Lastly - both the skipdays and skiphours fields require special values - and these are actually documented. The skipdays value is a list of days and skiphours is a list of hours.

<cfset meta.skipHours = "0,1,2,3,4,5,6"> <cfset meta.skipDays = "Saturday,Sunday">

Another cool metadata field is image. When used, this provides a nice little logo when viewing the feed. (At least it did in Firefox.)

<cfset meta.image = structNew()> <cfset meta.image.title = "Logo"> <cfset meta.image.url = "http://localhost/ows/images/logo_a.gif"> <cfset meta.image.link = meta.link>

One field in particular that was interesting was the textInput field. Form the specs:

A channel may optionally contain a <textInput> sub-element, which contains four required sub-elements.

Ok - that’s cool - but then the next paragraph reads:

The purpose of the <textInput> element is something of a mystery. You can use it to specify a search engine box. Or to allow a reader to provide feedback. Most aggregators ignore it.

Sweet. I love it when specs say something is a mystery. Below is the complete set of metadata I tried, all of which worked (except textInput, it did show up in the xml, but Firefox didn’t do anything with it). Tomorrow I’m going to do the same digging for Atom.

<!--- Struct to contain metadata ---> <cfset meta = structNew()> <cfset meta.title = "Orange Whip Studio Films"> <cfset meta.link = "http://localhost/ows"> <cfset meta.description = "Latest Films">

<cfset meta.language = “Klingon”> <cfset meta.copyright = “I own you.”> <cfset meta.managingEditor = “ray@camdenfamily.com”> <cfset meta.webmaster = “ray@camdenfamily.com”> <cfset meta.pubDate = now()> <cfset meta.lastBuildDate = now()>

<cfset meta.category = []> <cfset meta.category[1] = structNew()> <cfset meta.category[1].domain = “foo”> <cfset meta.category[1].value = “Boogers”>

<cfset meta.generator = “ColdFusion 8, baby”> <cfset meta.docs = “http://cyber.law.harvard.edu/rss/rss.html”>

<cfset meta.cloud = structNew()> <cfset meta.cloud.domain =”rpc.sys.com”> <cfset meta.cloud.port = “80”> <cfset meta.cloud.path = “/rpc2”> <cfset meta.cloud.registerProcedure=”pingMe”> <cfset meta.cloud.protocol = “soap”>

<cfset meta.ttl = 60>

<cfset meta.image = structNew()> <cfset meta.image.title = “Logo”> <cfset meta.image.url = “http://localhost/ows/images/logo_a.gif”> <cfset meta.image.link = meta.link>

<cfset meta.rating = “pics rating”>

<cfset meta.textInput = structNew()> <cfset meta.textInput.title = “Search”> <cfset meta.textInput.description = “Use this to search our site”> <cfset meta.textInput.name = “search”> <cfset meta.textInput.link = “http://localhost/ows/69/_temp.cfm”>

<cfset meta.skipHours = “0,1,2,3,4,5,6”> <cfset meta.skipDays = “Saturday,Sunday”>

<cfset meta.version = “rss_2.0”> </code>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments