Google Sitemap
Google Sitemap
Implemented in Version phpwcms 1.2.8
Last edited by markoehl on Mon 4. Dec 2006, 23:18, edited 8 times in total.
- Fulvio Romanin
- Posts: 394
- Joined: Thu 4. Dec 2003, 11:12
- Location: Udine, Italy
- Contact:
Re: Sitemaps
Can you post the link of the sitemap.xml file?Buletti wrote:Hi Folks,
if i use thise sitemap hack and i transer it to google, google says.
this format is not supported
Any ideas ?
Or checkout new version Get the new Files http://www.pagewerkstatt.ch/phpwcms_mod_sitemap.zip
Last edited by markoehl on Thu 5. Jan 2006, 00:09, edited 1 time in total.
two suggestions:
1. in googleSitemap.inc.php on line 62 after
i would replace
with
this will format your sitemap in a nice way.
2. in article.editcontent.inc.php on line 33 i would add at the end of the sql-statement
so it saves only active and public articles and articles that are marked for the phpwcms-sitemap-module.
the correct line would be
1. in googleSitemap.inc.php on line 62 after
Code: Select all
function generateSitemap()
{
Code: Select all
$strSitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$strSitemap .= "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n";
Code: Select all
$strSitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$strSitemap .= "<?xml-stylesheet type=\"text/xsl\" href=\"gss.xsl\"?>\n";
$strSitemap .= "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">\n";
2. in article.editcontent.inc.php on line 33 i would add at the end of the sql-statement
Code: Select all
WHERE article_public=1 AND article_aktiv=1 AND article_nositemap=1
the correct line would be
Code: Select all
$sql = "SELECT article_id, article_cid, date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".DB_PREPEND."phpwcms_article WHERE article_public=1 AND article_aktiv=1 AND article_nositemap=1;";
Update google sitemap
Thanx Mate
great feedback. I implemented this new code and added also the gss files. Looks much better now!!
Get the new Files http://www.pagewerkstatt.ch/phpwcms_mod_sitemap.zip
great feedback. I implemented this new code and added also the gss files. Looks much better now!!
Get the new Files http://www.pagewerkstatt.ch/phpwcms_mod_sitemap.zip
hi,
problem with a local installation ( xampplite - XJ! )
squidi
problem with a local installation ( xampplite - XJ! )
Code: Select all
Fatal error: URL http://localhost:8888/phpwcms/ not valid. Must be http[s]://[some.]domain.ext/ in C:\xampplite\htdocs\phpwcms\include\inc_lib\googleSitemap.inc.php on line 24
Last edited by squidi on Sat 14. Jan 2006, 13:55, edited 2 times in total.
squidi - open your eyes before you dance
To test with a local installation you have do replace codesquidi wrote:hi,
problem with a local installation ( xampplite - XJ! )
squidiCode: Select all
Fatal error: URL http://localhost:8888/phpwcms/ not valid. Must be http[s]://[some.]domain.ext/ in C:\xampplite\htdocs\phpwcms\include\inc_lib\googleSitemap.inc.php on line 24
if (!preg_match("/^https?:\/\/[a-z]([a-z0-9-.]+)+?.[a-z]+\/$/i", $strBaseURL))
{
trigger_error("URL {$strBaseURL} not valid. Must be http://[some.]domain.ext/", E_USER_ERROR);
}
else
{
$this->strBaseURL = $strBaseURL;
}
with
$this->strBaseURL = $strBaseURL;
Regards
@arkon
I added
in article.editcontent.inc.php on line 33 to avoid listing deleted articles in the sitemap
volkman
I added
Code: Select all
AND article_deleted=0
volkman
Thanx. I modified the script too....volkman wrote:@arkon
I addedin article.editcontent.inc.php on line 33 to avoid listing deleted articles in the sitemapCode: Select all
AND article_deleted=0
volkman
Alias ind sitemapfile
I wanted the aliasname in the sitemapfile instead of /index.php?id=92,0,26,0....
So i modified the SQL-Statement in article.editcontent.inc.php. I am selecting fields from two tables (phpwcms_article and phpwcms_articlecat). If article_cid (from phpwcms_article) and acat_id (from phpwcms_articlecat) are the same fetch the acat_alias, thats it.
We only need $row[1] (the alias) and $row[3] (date of modification).
After editing the file the map looks like this:
Hope that helps,
volkman
So i modified the SQL-Statement in article.editcontent.inc.php. I am selecting fields from two tables (phpwcms_article and phpwcms_articlecat). If article_cid (from phpwcms_article) and acat_id (from phpwcms_articlecat) are the same fetch the acat_alias, thats it.
Code: Select all
$sql = "SELECT acat_id, acat_alias, article_cid, date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date ";
$sql .= "FROM ".DB_PREPEND."phpwcms_articlecat, phpwcms_article WHERE (acat_id = article_cid) AND article_public=1 AND article_aktiv=1 AND article_nositemap=1 AND article_deleted=0;";
if($result = mysql_query($sql, $db)) {
while($row = mysql_fetch_row($result)) {
$oSitemap->addEntry(
array('loc' => 'index.php?'.$row[1].'',
'lastmod' => $row[3],
'changefreq' => 'monthly',
'priority' => '0.8'));
}
mysql_free_result($result);
}
After editing the file the map looks like this:
Code: Select all
<loc>http://www.yourdomain.de/index.php?sitemap</loc>
<lastmod>2006-03-05T18:15:30+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.yourdomain.de/index.php?kompetenznetz</loc>
<lastmod>2006-03-14T10:07:21+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.yourdomain.de/index.php?patient</loc>
<lastmod>2006-03-05T16:33:36+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
volkman