Last active
November 2, 2015 23:15
-
-
Save ronnieduke/2cf867aa26494032e3c1 to your computer and use it in GitHub Desktop.
How to create a podcast XML feed using Mura CMS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Add this to your {theme}/remote/podcast.cfm ---> | |
<!--- Set your siteID ---> | |
<!--- This is important because iTunes does not have a session to your Mura site when accessing the XML, | |
so you have to set the site ID manually ---> | |
<cfset siteid='yourSiteID'> | |
<cfscript> | |
$= application.serviceFactory.getBean('$').init(siteid); | |
// In your Mura Architecture, you will want to create a "Show" for wach of the episodes to live under. | |
// Getting the Show details so you can tell iTiunes about the Show | |
show=$.getBean('content').loadBy(contentid=$.event('showid')); | |
// Get the host from a User bean loaded into the show, or set this manually | |
host=$.getBean('user').loadBy(username=show.getRemoteID()); | |
hostName=host.getFname() & host.getLName(); | |
// Set the feed in the Content Collections to pull your episodes from your site manager | |
feed=$.getBean('feed').loadBy(feedid=$.event('feedid')); | |
// Get the feed iterator | |
it=feed.getIterator(); | |
</cfscript> | |
<cfheader name="content-type" value="charset=UTF-8"><cfcontent reset="yes"><cfoutput><?xml version="1.0" encoding="UTF-8"?> | |
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> | |
<channel> | |
<!--- Set the details for the main show. This can be set manually, or via the show bean set above ---> | |
<title>#XMLFormat(show.getTitle())#</title> | |
<itunes:summary>#XMLFormat(show.getSummary())#</itunes:summary> | |
<description>#XMLFormat(show.getSummary())#</description> | |
<itunes:author>#XMLFormat(hostName)#</itunes:author> | |
<itunes:subtitle></itunes:subtitle> | |
<itunes:owner> | |
<itunes:name>#XMLFormat(hostName)#</itunes:name> | |
<itunes:email>#XMLFormat(host.getEmail())#</itunes:email> | |
</itunes:owner> | |
<link>#XMLFormat(show.getURL(complete=1))#</link> | |
<itunes:image href="#XMLFormat(show.getImageURL())#" /> | |
<pubDate>#dateFormat(show.getReleaseDate(),'ddd, dd mmm yyyy')# #timeFormat(show.getReleaseDate(),'hh:mm:ss')# CDT</pubDate> | |
<language>en-us</language> | |
<copyright> Copyright #XMLFormat($.siteConfig('site'))# </copyright> | |
<itunes:category text="Music" /> | |
<itunes:explicit>no</itunes:explicit> | |
<!--- loop though the episodes. This is determined by your feed above ---> | |
<cfloop condition="it.hasNext()"> | |
<cfset item=it.next()> | |
<item> | |
<title>#XMLFormat(item.getTitle())#</title> | |
<itunes:subtitle></itunes:subtitle> | |
<itunes:summary>#XMLFormat(item.getSummary())#</itunes:summary> | |
<itunes:author>#XMLFormat(hostName)#</itunes:author> | |
<pubDate>#dateFormat(item.getReleaseDate(),'ddd, dd mmm yyyy')# #timeFormat(item.getReleaseDate(),'hh:mm:ss')# CDT</pubDate> | |
<guid>#item.getURLForFile(filename=item.getFileID(),complete=1)#</guid> | |
<enclosure url="#item.getURLForFile(filename=item.getFileID(),complete=1)#" length="" type="audio/mpeg" /> | |
<itunes:duration></itunes:duration> | |
</item> | |
</cfloop> | |
</channel> | |
</rss> | |
</cfoutput> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This would be your url: | |
http://www.domain.com/{siteid}/includes/themes/{themeName}/remote/podcast.cfm?showid=xxxxxxxxxxxxxxx&feedid=xxxxxxxxxxxxxxxx | |
Show ID would be the name of the "Show" content node in Mura | |
Feed ID would be the name of the content collection feed, pulling episodes from that "Show" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment