}
function serendipity_rss_getguid($entry, $comments = false) {
- $guid = serendipity_archiveURL((isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']), 'guid', 'baseURL', true, array('timestamp' => $entry['timestamp']));
+ global $serendipity;
+
+ $id = (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']);
+
+ // When using %id%, we can make the GUID shorter and independent from the title.
+ // If not using %id%, the entryid needs to be used for uniqueness.
+ if (stristr($serendipity['permalinkStructure'], '%id%') !== FALSE) {
+ $title = 'guid';
+ } else {
+ $title = $id;
+ }
+
+ $guid = serendipity_archiveURL(
+ $id,
+ $title,
+ 'baseURL',
+ true,
+ array('timestamp' => $entry['timestamp'])
+ );
+
if ($comments == true) {
$guid .= '#c' . $entry['commentid'];
}
serendipity_plugin_api::hook_event('frontend_rss', $metadata);
+$self_url = 'http://' . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER['REQUEST_URI']);
echo '<?xml version="1.0" encoding="utf-8" ?>';
if (strstr($version, 'atom')) {
xmlns:admin="http://webns.net/mvcb/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
- <link href="{$serendipity['baseURL']}rss.php?version=atom1.0" rel="self" title="{$metadata['title']}" type="application/x.atom+xml" />
+ <link href="{$self_url}" rel="self" title="{$metadata['title']}" type="application/x.atom+xml" />
<link href="{$serendipity['baseURL']}" rel="alternate" title="{$metadata['title']}" type="text/html" />
<link href="{$serendipity['baseURL']}rss.php?version=2.0" rel="alternate" title="{$metadata['title']}" type="application/rss+xml" />
<title type="html">{$metadata['title']}</title>