Google Sitemaps for MediaWiki

From LemonWiki共筆
Revision as of 16:43, 10 February 2008 by Planetoid (talk | contribs) (新頁面: << MediaWiki "The Sitemap Protocol allows you to inform search engines about URLs on your websites that are available for crawling." (Quoted from [https://www.google.com/webmasters/t...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<< MediaWiki

"The Sitemap Protocol allows you to inform search engines about URLs on your websites that are available for crawling." (Quoted from Google Sitemap Protocol) Google Sitemaps for MediaWiki list all URLs of wiki pages for crawling,

MediaWiki v.1.4, 1.11.0+



Installation


Troubleshooting: URL are the same http://wiki.example.com/

URLs of wiki page <loc> at Sitemap file are the same URL: http://wiki.example.com/ not the correct URL of each wiki page: http://wiki.example.com/index.php/Page_Name

The correct Sitemap may appeared as follows (Sitemap Protocol):

   < url>
    < loc>http://wiki.example.com/index.php/Page_Name</loc>
    < lastmod>2005-01-01</lastmod>
    < changefreq>monthly</changefreq>
    < priority>1</priority>
   </url>  

I modified the partial code as follows:

original code

# -----------------------------------------------------
# Start output
# -----------------------------------------------------

?>
	<url>
		<loc><?php echo fnXmlEncode( "http://" . $wgServerName . eregi_replace('\$1',$sPageName,$wgArticlePath) ) ?></loc>
		<lastmod><?php echo fnTimestampToIso($row_rsPages['page_touched']); ?></lastmod>
		<changefreq>weekly</changefreq>
		<priority><?php echo $nPriority ?></priority>
	</url>
<?php } while ($row_rsPages = mysql_fetch_assoc($rsPages)); ?>
</urlset> 


modified code

# -----------------------------------------------------
# Start output
# -----------------------------------------------------

?>
	<url>
		<loc><?php echo fnXmlEncode( "http://" . $wgServerName ) ?>/index.php/<?php echo fnXmlEncode( $sPageName ) ?></loc>
		<lastmod><?php echo fnTimestampToIso($row_rsPages['page_touched']); ?></lastmod>
		<changefreq>weekly</changefreq>
		<priority><?php echo $nPriority ?></priority>
	</url>
<?php } while ($row_rsPages = mysql_fetch_assoc($rsPages)); ?>
</urlset>


Further reading