Merge pull request #91 from hannob/master
set xmlns for sitemap-news also with gnews_single mode
This commit is contained in:
commit
92ad83baf3
1 changed files with 14 additions and 13 deletions
|
@ -592,18 +592,6 @@ class serendipity_event_google_sitemap extends serendipity_event {
|
|||
function write_sitemap($basefilename = 'sitemap.xml', &$eventData, $gnewsmode = false) {
|
||||
global $serendipity;
|
||||
|
||||
// start the xml
|
||||
$sitemap_xml = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
||||
$sitemap_xml .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n";
|
||||
$sitemap_xml .= "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
|
||||
if ($gnewsmode) {
|
||||
$sitemap_xml .= "\txmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"\n";
|
||||
}
|
||||
$sitemap_xml .= "\txsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n";
|
||||
$sitemap_xml .= "\t\t\thttp://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" ";
|
||||
$sitemap_xml .= $this->get_config('custom2');
|
||||
$sitemap_xml .= ">\n";
|
||||
|
||||
$this->gnewsmode = false;
|
||||
|
||||
// If this variable is enabled, each XML article will get its gnews:... counterpart.
|
||||
|
@ -614,6 +602,19 @@ class serendipity_event_google_sitemap extends serendipity_event {
|
|||
$this->gnewsmode = true;
|
||||
}
|
||||
|
||||
// start the xml
|
||||
$sitemap_xml = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
||||
$sitemap_xml .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n";
|
||||
$sitemap_xml .= "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
|
||||
if ($this->gnewsmode) {
|
||||
$sitemap_xml .= "\txmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"\n";
|
||||
}
|
||||
$sitemap_xml .= "\txsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n";
|
||||
$sitemap_xml .= "\t\t\thttp://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" ";
|
||||
$sitemap_xml .= $this->get_config('custom2');
|
||||
$sitemap_xml .= ">\n";
|
||||
|
||||
|
||||
|
||||
// add link to the main page
|
||||
$this->addtoxml($sitemap_xml, $serendipity['baseURL'], time(), 0.6);
|
||||
|
|
Loading…
Reference in a new issue