Description
The RSS enclosure plugin allows you to attach a file to your blog entry as an enclosure element
that would be picked up by RSS enclosure-aware aggregators. This is useful for podcasting
.
This plugin requires use of the Meta plugin.
Installation and Setup
In your global /WEB-INF/plugin.properties file, add the following line:
rss-enclosure=org.blojsom.plugin.common.RSSEnclosurePlugin
You may then add "rss-enclosure" to one of the flavor-based plugin chains. It must occur after the meta plugin. These plugin chains can be found in the individual user's plugin.properties file. For example:
blojsom-plugin-chain=meta, rss-enclosure, conditional-get, limiter
Usage and URL Parameters
Usage
1. Upload a file you want to attach to your blog entry. This should be done through the web interface as this plugin looks for the enclosure file in your blog's resources directory.
2. On adding or editing an entry, this plugin will modify the entry page to allow you to select a file from your resources directory as an RSS enclosure. You may also provide explicit values for the enclosure using the form items for those values.
Alternatively, create an entry and use the meta-rss-enclosure on a blank line with the name of the file you just uploaded.
The following is a sample blog entry:
The daily podcast entry title
meta-rss-enclosure=10-18-2004-podcast.mp3
BEHOLD! A new podcast for your listening pleasure!
After the RSS enclosure plugin executes, it will populate the meta-data of that blog entry with an item rss-enclosure. This item contains the proper <enclosure .../> element as given by the RSS 2.0 specification
. In the example entry above, this might look like:
<enclosure url="http://your.site.com/blog/resources/default/10-18-2004-podcast.mp3" length="51680279" type="audio/x-mpeg"/>
If the RSS enclosure plugin cannot determine the correct MIME type for the enclosure item, it will use a default type of application/octet-stream.
3. You may extract the enclosure element in your RSS 2.0 template by including the following template code before the closing </item> tag:
$!entry.getMetaData().get("rss-enclosure")
For example, adding this to rss2.vm would look as follows:
...
<item>
<title>$entry.getEscapedTitle()</title>
<link>$entry.getEscapedLink()</link>
...
$!entry.getMetaData().get("rss-enclosure")
</item>
...
Alternatively, you may use the #RSSEnclosure($entry) macro to print out the enclosure information in a template. The above example would change to the following:
...
<item>
<title>$entry.getEscapedTitle()</title>
<link>$entry.getEscapedLink()</link>
...
#RSSEnclosure($entry)
</item>
...
URL Parameters
There are no URL parameters that affect the operation or output of this plugin.
Metadata Attributes and Types
The following table describes the metadata attributes that are available on the BlogEntry object and their associated type. This information is only populated in an entry's metadata if there is an associated enclosure with the entry.
In your template, you would retrieve the metadata through a call like:
$entry.getMetaData().get("metadata-key")
| Metadata key |
Type |
Description |
| rss-enclosure |
String |
RSS enclosure element populated with data about the RSS enclosure associated with the particular entry. |
| rss-enclosure-object |
org.blojsom.plugin.common.RSSEnclosure |
Helper class which holds the information about the enclosure. You can call the getUrl(), getLength(), and getType() methods on this object. |