Für mein Frage und Antwort Portal – Frageee.de, welches mit der Open Source Software Question2Answer betrieben wird, habe ich ein kleines PHP Skript geschrieben, was dafür sorgt, dass alle bereits gestellten Fragen im Google Index landen.
Ohne Sitemap wurden bei uns nur circa 50-60% Fragen zeitnah indiziert.
Die Datei muss in das Root Verzeichniss eurer Question2Answer Installation kopiert werden und die Zeile $urlpath=”http://frageee.de/” muss angepasst werden.
Danach muss die Sitemap in den Google Webmaster Tools eingereicht werden.
Wichtig:Zum Kopieren erst einmal auf “view plain” klicken, WordPress zerschiesst teilweise den Code bei der Ausgabe.
English:
- Copy the code (click on view plain first) to your question2answer root directory as sitemap.php.
- Change “http://frageee.de” to your Site URL.
- Log into Google Webmasters Tools and add the sitemap URL.
$urlpath="http://frageee.de/";
include "qa-config.php";
define("QA_BASE_DIR", dirname(empty($_SERVER["SCRIPT_FILENAME"]) ? __FILE__ : $_SERVER["SCRIPT_FILENAME"])."/");
require_once "qa-include/qa-base.php";
echo '
'.$urlpath.'
2010-05-03T19:59:46+00:00
daily
1.0
';
mysql_connect(localhost,QA_MYSQL_USERNAME,QA_MYSQL_PASSWORD);
@mysql_select_db(QA_MYSQL_DATABASE) or die( "Unable to select database");
if ($_GET["all"] == "1") $getAll = 1;
else $getAll = 0;
$query = "select postid, type, parentid, title, content, created from qa_posts where (type = 'Q') order by created desc";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i = 0;
while ($i < $num)
{
$postId = mysql_result($result, $i, "postid");
$type = mysql_result($result, $i, "type");
$parentId = mysql_result($result, $i, "parentid");
$created = mysql_result($result, $i, "created");
$title = mysql_result($result, $i, "title");
echo '
'.$urlpath.qa_q_request($postId , $title).'
'.date("Y-m-d\TH:i:s+00:00",strtotime($created)).'
Daily
0.5
';
$i++;
}
echo '
';
Related posts:
June 10th, 2010 on 10:37
error code http://www.sorular.tk/sitemap.php
————-
$urlpath=”http://www.sorular.tk/”; include “qa-config.php”; define(“QA_BASE_DIR”, dirname(empty($_SERVER["SCRIPT_FILENAME"]) ? __FILE__ : $_SERVER["SCRIPT_FILENAME"]).”/”); require_once “qa-include/qa-base.php”; echo ‘ ‘.$urlpath.’ 2010-05-03T19:59:46+00:00 daily 1.0 ‘; mysql_connect(QA_MYSQL_HOSTNAME,QA_MYSQL_USERNAME,QA_MYSQL_PASSWORD,QA_MYSQL_DATABASE); @mysql_select_db(QA_MYSQL_DATABASE) or die( “Unable to select database”); if ($_GET["all"] == “1″) $getAll = 1; else $getAll = 0; $query = “select postid, type, parentid, title, content, created from qa_posts where (type = ‘Q’) order by created desc”; $result = mysql_query($query); $num = mysql_numrows($result); $i = 0; while ($i < $num) { $postId = mysql_result($result, $i, "postid"); $type = mysql_result($result, $i, "type"); $parentId = mysql_result($result, $i, "parentid"); $created = mysql_result($result, $i, "created"); $title = mysql_result($result, $i, "title"); echo ' '.$urlpath.qa_q_request($postId , $title).' '.date("Y-m-d\TH:i:s+00:00",strtotime($created)).' Daily 0.5 '; $i++; } echo ' ';
June 10th, 2010 on 12:19
You forgot to add < ? at the beginning of sitemap.php and ?> at the end of sitemap.php
June 12th, 2010 on 20:45
http://www.sorular.tk/sitemap.php
i did its but website has error
June 12th, 2010 on 20:48
thanks, it is beatiful… No problem
June 26th, 2010 on 22:00
http://www.prepare4interview.com/sitemap.php
It is showing all urls with dates..
But when i submited this url to google webmaster got follwoing error:
Parsing error
We were unable to read your Sitemap. It may contain an entry we are unable to recognize. Please validate your Sitemap before resubmitting
What could be the reason..
Can we get html site map?
July 22nd, 2010 on 08:33
When i submited my sitemap to google webmaster got follwoing error: red cross in the Status column. Help me please