Mac OS X Server Weblog Service: Modifying XML templates for the iTunes Store

Mac OS X Server 10.4.3 or later supports RSS2 enclosures and podcasting. Although the server includes the basic RSS2 tags needed for podcasting, it doesn't include the required tags to submit podcasts to the iTunes Store. This article shows how to modify the RSS2 template so that blog entries from the Weblog Server can be considered for publication on the iTunes Store.

To find more information about the iTunes-specific RSS2 tags, click here.

Note: This advanced how-to requires you to edit XML-formatted text files. Apple does not provide any further technical support or assistance with performing this task.

Part I: Modifying the RSS2.vm template

  1. Log in as an administrator of the server.
  2. Make a backup copy of the file:

    /Library/Tomcat/blojsom_root/webapps/ROOT/WEB-INF/templates/rss2.vm

  3. Open TextEdit.
  4. Open the following file in TextEdit:

    /Library/Tomcat/blojsom_root/webapps/ROOT/WEB-INF/templates/rss2.vm

  5. Locate the first <image> section below the opening <channel> tag. This is where you need to insert your blog server's iTunes Store channel attributes. Using the default rss2.vm file, here is an example of what this looks like (our inserted text is shown in blue):
    <?xml version="1.0"?>
    <!-- name="generator" content="$BLOJSOM_VERSION" -->
    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" 
    xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
    	<channel>
    		<title>$BLOJSOM_BLOG.getBlogName()</title>
    		<link>$BLOJSOM_BLOG.getBlogURL()</link>
    		<description>$BLOJSOM_BLOG.getBlogDescription()</description>
    		<language>$BLOJSOM_BLOG.getBlogLanguage()</language>
    		<image>
    			<url>$BLOJSOM_SITE_URL/favicon.ico</url>
    			<title>$BLOJSOM_BLOG.getBlogName()</title>
    			<link>$BLOJSOM_BLOG.getBlogURL()</link>
    		</image>
    		<itunes:author>www.demo.edu</itunes:author>
    		<itunes:owner>
    			<itunes:name>Demo University</itunes:name>
    			<itunes:email>podcast@demo.edu</itunes:email> 
    		</itunes:owner>
    		<itunes:link rel="image" type="video/jpeg" href="http://www.demo.edu/demo_u.jpg">About Demo University</itunes:link>
    		<itunes:category text="Education">
    			<itunes:category text="Higher Education"/>
    		</itunes:category>
    		<copyright>Copyright 2005 demo.edu</copyright>
  6. Now locate the first <description> tag line below the opening <item> tag. This is where you need to insert the iTunes Store attribute tags. Using the default rss2.vm file, here is an example of what this looks like (again, our inserted text is shown in blue):
             #foreach ($entry in $BLOJSOM_ENTRIES)
             		<item>
             		<title>$entry.getEscapedTitle()</title>
             		<link>$entry.getEscapedLink()</link>
             		<description>$entry.getEscapedDescription()</description>
             		<itunes:author>$BLOJSOM_BLOG.getBlogOwner() from demo.edu</itunes:author>
             		<itunes:subtitle>Boost your knowledge at Demo University</itunes:subtitle>
             		<itunes:summary>Episodes from demo University.</itunes:summary>
             		<itunes:category text="Education">
             			<itunes:category text="Higher Education"/>
             		</itunes:category>
             		<itunes:explicit>no</itunes:explicit>
             		<itunes:keywords>education college university lecture</itunes:keywords>
    Note: In the example above, we're editing the default rss2.vm file. As a result, all of the information above is static except for the variable used for the blog owner. When editing the default rss2.vm file, all information will be the same for every item of every blog on the server. However, you can make a blog-specific template and use it to override the default, thus achieving different RSS templates for different blogs.

    To create a template that's specific to a user's blog, create a new "templates" folder in the user's blog folder:
    /Library/Tomcat/blojsom_root/webapps/ROOT/WEB-INF/<username>/templates
    If you put a modified copy of rss2.vm in the folder, the weblog server will use that template instead of the one in /WEB-INF/templates, because the user-specific file takes precedent over the main template when present. With this method, only the information in that specific blog will have the customized tags.

Part II: Test your blog site

To test your blog site to make sure that the RSS2 links function properly, go to a blog and click on the RSS2 or RSS Podcast links. You shouldn't see any of the tags or information you entered. These tags are only used by the iTunes Store. If any of the information is displayed incorrectly, revise your edits in the RSS2.vm file or revert to the backup copy you made.

Tip: You can see your custom tags by using the command-line utility curl. In Terminal, type:

curl "http://<server address>:<port>/weblog/<user shore name>/?flavor=rss2"

For example, let's say your server address is www.demo.edu, it's running on port 80, and your user's shortname is "joe." You'd then type this curl command in the Terminal:

curl "http://www.demo.edu/weblog/joe/?flavor=rss2"

This will return the RSS2 xml text from the web server. The custom iTunes Store tags should be returned.

Part III: Submit your blog for consideration on the iTunes Store

  1. See this article for details about publishing to the iTunes Store.
  2. To submit your blog site for iTunes Store consideration, use this URL format:

    http://<server address>:<port>/weblog/<user shore name>/?flavor=rss2

    For example, if your server address is www.demo.edu, running on port 80, and your user's shortname is "joe," you'd submit this URL:

    http://www.demo.edu/weblog/joe/?flavor=rss2

Related Articles

Published Date: Feb 19, 2012