[pmwiki-users] Feed <meta> links in skin.php
    H. Fox 
    haganfox at users.sourceforge.net
       
    Sat Dec 17 22:04:05 CST 2005
    
    
  
I'd like to put some logic in the Light Skin that does the following
(pseudo code)
   if (RSS feed is enabled)
     Produce an RSS link for the header
   if (Atom feed is enabled)
     Produce an RSS link for the header
It doesn't look like that's possible, but that's no big deal.
So far I've come up with the following for the skin.php file.
(Apparently you can't invoke scripts/feeds.php from the skin.php.)
## Place <meta> links to RSS and Atom feeds in the HTML Header.
##
## To enable the feeds, use the following in your local/config.php file:
##
##   if ($action == 'rss' || $action == 'atom') {
##     @include_once("$FarmD/scripts/feeds.php"); }
##
SDV($EnableSitewideFeed, FALSE);  # Link to Site/AllRecentChanges,
                                 # otherwise link to a group-specific feed
SDV($EnableRssLink, TRUE);
SDV($EnableAtomLink, TRUE);
global $HTMLHeaderFmt;
if (@$EnableSitewideFeed == TRUE) {
 $FeedSourcePath = '$SiteGroup/AllRecentChanges';
 $FeedTitleGroup = '';
} else {
 $FeedSourcePath = '$Group/RecentChanges';
 $FeedTitleGroup = ' : $Group -';
}
if ($EnableRssLink) {
 $HTMLHeaderFmt[rsslink] =
   "<link rel='alternate' title='\$WikiTitle$FeedTitleGroup RSS Feed'
     href='\$ScriptUrl/$FeedSourcePath?action=rss'
     type='application/rss+xml' />\n  ";
}
if ($EnableAtomLink) {
 $HTMLHeaderFmt[atomlink] =
   "<link rel='alternate' title='\$WikiTitle$FeedTitleGroup Atom Feed'
     href='\$ScriptUrl/$FeedSourcePath?action=atom'
     type='application/atom+xml' />\n  ";
}
This code is a rough first try.  Suggestions for improvement
enthusiastically welcomed.
One observation: Using a Firefox's "Live Bookmark" for testing, an RSS
link looks like
   Main / HomePage
and an Atom link looks like
   HomePage
Hagan
Reference for the format of the <meta> links:
http://www.google.com/webmasters/bot.html#autodiscovery
    
    
More information about the pmwiki-users
mailing list