[pmwiki-users] Blog RSS feed markup
Thomas -Balu- Walter
list+pmwiki-users at b-a-l-u.de
Wed Jan 16 11:12:21 CST 2008
On Wed, Jan 09, 2008 at 01:55:56PM +0000, Steve Glover wrote:
> Can anyone tell me, please, what I need to change to stop wiki markup
> appearing in an RSS feed?
I've added the following code to my config.php. It's been a while since
I looked at it and it might not be the best way to do it, but perhaps
it'll help you.
What I'd really like to add is a "more" link, but I'd really need a way
to figure out the page variable and how to add the proper code to the
entry.
// support feeds
if ($action=='rss') {
include_once('scripts/feeds.php');
// only do this for the 'Blog' group
$_group = PageVar($pagename, '$Group');
if ($_group=='Blog') {
// set defaults for the blog group
$_REQUEST = array(
'group' => $_group,
'name' => '????-??-??[-_]*',
'order' => '-name',
'count' => 10
);
// global RSS options
$FeedFmt['rss']['feed']['title'] = '$WikiTitle Blog';
$FeedFmt['rss']['feed']['description'] = 'Balus Blog';
// why is ?action=rss added by default to the link tag?
// Am I missing something? Anyway, remove it using:
$FeedFmt['rss']['feed']['link'] = '{$PageUrl}';
// Google Reader does not like text/xml? :-(
// proper value should be application/rss+xml anyhow
$FeedFmt['rss']['feed']['_header'] = 'Content-type: application/rss+xml; charset="$Charset"';
// helper function that fetches the title pagetext variable for each item
// (or the default from page BlogOverviewTemplate)
function BlogTitle($pagename)
{
$PTVTitle = PageTextVar($pagename, 'Title');
if ($PTVTitle=='') $PTVTitle = PageTextVar($_group.'/BlogOverviewTemplate', 'TitleDefault');
$PTVTitle = strip_tags(MarkupToHTML($pagename, $PTVTitle));
return $PTVTitle;
}
$FmtPV['$BlogTitle'] = 'BlogTitle($pn)';
$FmtPV['$BlogExcerpt'] = 'htmlspecialchars(MarkupToHTML($pn, "(:include $pn#entrybody#extendedbody:)"))';
// content of RSS items (besides default)
$FeedFmt['rss']['item']['title'] = '$BlogTitle';
$FeedFmt['rss']['item']['description'] = '$BlogExcerpt';
// W3C feed validator says: an item should not include both pubDate and dc:date
// W3C feed validator says: item should contain a guid element
$FeedFmt['rss']['item']['dc:date'] = '';
$FeedFmt['rss']['item']['guid'] = '<guid isPermaLink="true">{$PageUrl}</guid>'."\n";
}
}
Balu
More information about the pmwiki-users
mailing list