Seite 2 von 7

Verfasst: 29.05.2006 12:12
von IPB_Flüchtling
@DreamPromise: Warum hast Du denn Dein Forum nicht als .zip-Datei gepostet? Dann hätte ich Dein anderes Problem schon längst gelöst!

@alle, die sich für SEO interessieren:

Verwendet Ihr überhaupt eine Sitemap? Ich habe meine wieder rausgeschmissen - hat überhaupt nichts gebracht (außer toten URLs im Google-Index nach der Entfernung).

Recent und Similar - ja, unbedingt! Aber eine Sitemap scheint mir persönlich überflüssig zu sein. Eine Sitemap, die aus mehreren "Klicktiefen" besteht, bringt gar nichts - dasselbe haben wir ja sowieso schon im Forum. Und eine Sitemap mit Hunderten (oder noch mehr) Links auf einer Seite bringt auch nichts. Wie seht Ihr das?

LG, IPB_Flüchtling

Verfasst: 29.05.2006 12:39
von mgutt
Solange die sitemap nicht wirklich alle Seiten umfasst finde ich die auch gefährlich. Es gibt ja meistens mehr Seiten, als nur das Forum.

Verfasst: 29.05.2006 14:29
von IPB_Flüchtling
Du meinst jetzt die speziellen Google-Sitemaps, nicht?

Also die halte ich ehrlich gesagt für noch größeren Blödsinn. Weshalb sollten wir Google Arbeit abnehmen? Denke ich ja im Traum nicht daran.

Alles, was intern ordentlich verlinkt ist und Gnade vor dem großen Google-Gott findet, kommt sowieso früher oder später in den Index. Bei den Seiten, die intern nicht ordentlich verlinkt aus einem anderen Grund für Google nicht interessant sind (zu wenig Content etc.), hilft auch die Google-Sitemap nicht weiter.

Meine bescheidene Meinung. Wie seht Ihr das?

LG, IPB_Flüchtling

Verfasst: 29.05.2006 15:01
von fanrpg
Schaden kann sie nicht.
Auf jeden Fall nach Einsatz 20 Seite mehr im Index :wink:

Verfasst: 29.05.2006 15:07
von larsneo
ich benutze (in verbindung mit den klassischen short urls) seit geraumer zeit sitemaps - und bin mit dem ergebnis wirklich sehr zufrieden. tante-g holt sich die dateien regelmässig ab und indexiert auch die verlinkten topics. gerade wenn man sich darauf konzentriert *weniger* aber dafür *relevante* inhalte bei -g zu platzieren kann die xml-geschichte gute dienste leisten :-)
die gimmicks in der sitemap-administration bei google sind darüberhinaus auch ein nettes beiwerk zur analyse...

Verfasst: 29.05.2006 15:24
von IPB_Flüchtling
Danke Euch beiden für die Antworten!

Bei fanrpg weiß ich es jetzt nicht genau (habe es mir nicht angesehen), aber bei larsneo bin ich mir doch relativ sicher, dass Google sich die Seiten auch ohne Sitemap liebend gerne abholen würde.
larsneo hat geschrieben:gerade wenn man sich darauf konzentriert *weniger* aber dafür *relevante* inhalte bei -g zu platzieren kann die xml-geschichte gute dienste leisten
Werde in einer ruhigen Stunde darüber nachdenken. :P

LG, IPB_Flüchtling

Verfasst: 02.07.2006 05:17
von Kortirion
Hallo zusammen,

da es hier viel zu heiß ist um zu schlafen, habe ich die Nacht dazu genutzt, eine google-sitemap für mgutts SEO Urls V2 weiterzuentwickeln.

Das ganze basiert auf den Änderungen von fanrpg am ursprünglichen Mod von NeoThermic. Allerdings habe ich den Code insofern abgeändert, als dass berücksichtigt wird, wann in den topics das letzte Mal gepostet wurde.

Ist das letzte Posting weniger als 1 Monat alt, gibt es ein <lastmod>"datum"</lastmod>, ist es älter, gibt es ein <changefreq>monthly</changefreq>. Sortiert wird nach Aktualität der Postings, die Profilseiten der User folgen am Schluss mit <changefreq>weekly</changefreq> .

Die Prioritäten habe ich abgestuft, da es imho keinen Sinn macht, das ganze einheitlich auf der selben Priorität zu haben. Es werden im Ggs. zu vorher nur Foren & Threads berücksichtigt, in denen auch tatsächlich Gäste Lesebefugnis haben.

Inspiriert wurde ich von dieser Diskussion auf phpbb.com.

Meine Fragen an Euch:

1. Was haltet Ihr generell von dem Ansatz?
2. Haltet Ihr die Gewichtung der Prioritäten für angemessen?
3. Sind die changefreqs vernünftig gesetzt?
4. Kann es ungünstig sein, dass bei topics mit mehreren Seiten auch die "älteren Seiten" mit <lastmod> deklariert sind? Sollten diese nicht auch auf <changefreq>monthly</changefreq> gesetzt werden und nur die aktuellste auf <lastmod>?

Der Code:

Code: Alles auswählen

<?PHP
/***************************************************************************
*
* Created:	Thursday, June 9, 2005 (Second to last day of Uni!)
* Author:	NeoThermic
* Modified:	fanrpg
*			Kortirion, Sunday, July 2, 2006
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//for testing, just mod this to be the base URL of your forums.
$secure = $board_config['cookie_secure'] ? 'https://' : 'http://';
$baseURL = $secure.$board_config['server_name'].$board_config['script_path'];

//we do this for hosts that have short tags enabled...
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<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">
	<url>
		<loc><?PHP echo $baseURL; ?></loc>
		<lastmod><?PHP echo date("Y-m-d"); ?></lastmod>
		<changefreq>always</changefreq>
		<priority>0.8</priority>
	</url>
<?PHP

//we need to set up an array so that we can store the fourm_id's of any fourm that has a auth_view larger than 0
$hidtopic = array();
$sql = 'SELECT forum_id, forum_name, forum_desc, auth_read FROM '.FORUMS_TABLE.' ORDER BY forum_name';
if( !($result = $db->sql_query($sql)) )
{
	message_die(CRITICAL_ERROR, "Could not query forum auth information", "", __LINE__, basedir(__FILE__), $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
	$forum_name = $row['forum_name'];
	if ($row["auth_read"] < 1)
	{
	//note, we have the code de-tabbed like this to provide a cleaner output...
	echo '
	<url>
		<loc>'.$baseURL.append_sid('viewforum.php?f='.htmlspecialchars($row["forum_id"])).'</loc>
		<changefreq>daily</changefreq>
		<priority>0.8</priority>
	</url>';
	}
	else
	{
		//add fourm_id of the one here to an array
		$hidtopic[]= $row["forum_id"]; //ok, we now have populated the array with the fourm_ID of the hidden topics
	}
}

//ok, now we mod the below so that it reads fourm_id as well
$sql = "SELECT t.topic_title, t.topic_id, t.topic_replies, t.forum_id, p.post_time
	FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
	WHERE p.post_id = t.topic_last_post_id
	ORDER BY p.post_time DESC";

if( !($result = $db->sql_query($sql)) )
{
   message_die(CRITICAL_ERROR, "Could not query topic information", "", __LINE__, basedir(__FILE__), $sql);
}

if( $db->sql_numrows($result) >= 50000 )
{
   message_die(CRITICAL_MESSAGE, "Sitemap generated will be too large. Please modify file to make multiple sitemaps.");
}

$i = 0;
while($row =  $db->sql_fetchrow($result))
{
	if ($hidtopic[$i] != $row["forum_id"])
	{
		//if we get here, then the fourm_id of the post in question can be displaied...
		//same tabbing reason as above

		//Do tell thee, how many pages does one have?
		$perpage = $board_config['posts_per_page'];
		$numpages = intval($row['topic_replies']/$perpage);

		if ($numpages == 0)
		{
			$topic_title = $row['topic_title'];
			echo '
				<url>
					<loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"])).'</loc>';
				if ((time() - $row['post_time']) < 2600000)
				{
					echo '
						<lastmod>'.date('Y-m-d',$row['post_time']).'</lastmod>
						<priority>0.8</priority>
					</url>';
				}
				else
				{
					echo '
						<changefreq>monthly</changefreq>
						<priority>0.5</priority>
					</url>';
				}
		}
		else
		{
			for ($j = 0; $j < ($numpages+1); $j++)
			{
				$topic_title = $row['topic_title'];
				$start = $j * $perpage;
				echo'
					<url>
						<loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"]).'&start='.$start).'</loc>';
				if ((time() - $row['post_time']) < 2600000)
				{
					echo '
						<lastmod>'.date('Y-m-d',$row['post_time']).'</lastmod>
						<priority>0.8</priority>
					</url>';
				}
				else
				{
					echo '
						<changefreq>monthly</changefreq>
						<priority>0.5</priority>
					</url>';
				}
			}
		}
	}
$i++;
}

$sql = "SELECT u.username, u.user_id FROM ".USERS_TABLE." u WHERE u.user_active = 1 AND u.user_active != '-1' ORDER BY u.user_id ASC";
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
	echo'
	<url>
		<loc>'.$baseURL.append_sid('profile.php?mode=viewprofile&u='.$row['user_id']).'</loc>
		<changefreq>weekly</changefreq>
		<priority>0.3</priority>
	</url>';
}
?>
</urlset>
Gruß...

Verfasst: 02.07.2006 12:16
von mgutt
Kortirion hat geschrieben:die Profilseiten der User folgen am Schluss mit <changefreq>weekly</changefreq> .
Wäre es hier nicht sinnvoll "monthly" zu verwenden. Ich mein, so oft wird das Profil ja nicht gerade aktualisiert.

Dann stell Dir vor Du wolltest alle Seiten von phpBB.de in den Index bringen wollen. Was wäre mit den Seiten wie "Mitgliederliste", "Downloads", "Mods" etc. Noch habe ich keine Idee in dieser Richtung. Theoretisch müsste man seine Seite selbst crawlen, um dann eine perfekte Liste zu generieren.

Weiterhin empfehle ich Dir eine XML Datei ausgeben zu lassen, dass Du zeitlich prüfen kannst, wann sie das letzte Mal ausgegeben wurde. Denn die ganzen Datenbankabfragen sollten irgendwo eingegrenzt werden können:
Erstmal in Anzahl (was ist bei einem Board mit mehr als 100.000 Beiträgen) und dann zeitlich (die Liste muss ja nur einmal alle 12/24 Stunden generiert werden). Das würde Performanceprobleme vermeiden.

Verfasst: 02.07.2006 15:13
von fanrpg
@Kortirion

Nette Sitemap :)

@mgutt
Ja hast recht das würde schon einiges an Last bedeuten.

Code: Alles auswählen

<?php 
/*************************************************************************** 
* 
* Created:   Thursday, June 9, 2005 (Second to last day of Uni!) 
* Author:   NeoThermic 
* Modified:   fanrpg 
*         Kortirion, Sunday, July 2, 2006 
***************************************************************************/ 

/*************************************************************************** 
* 
* This program is free software; you can redistribute it and/or modify 
* it under the terms of the GNU General Public License as published by 
* the Free Software Foundation; either version 2 of the License, or 
* (at your option) any later version. 
* 
***************************************************************************/ 
@set_time_limit(360);
ob_start();
define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

//for testing, just mod this to be the base URL of your forums. 
$secure = $board_config['cookie_secure'] ? 'https://' : 'http://'; 
$baseURL = $secure.$board_config['server_name'].$board_config['script_path']; 

//we do this for hosts that have short tags enabled... 
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; 
?> 
<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"> 
   <url> 
      <loc><?php echo $baseURL; ?></loc> 
      <lastmod><?php echo date("Y-m-d"); ?></lastmod> 
      <changefreq>always</changefreq> 
      <priority>0.8</priority> 
   </url> 
<?php 

//we need to set up an array so that we can store the fourm_id's of any fourm that has a auth_view larger than 0 
$hidtopic = array(); 
$sql = 'SELECT forum_id, forum_name, forum_desc, auth_read FROM '.FORUMS_TABLE.' ORDER BY forum_name'; 
if( !($result = $db->sql_query($sql)) ) 
{ 
   message_die(CRITICAL_ERROR, "Could not query forum auth information", "", __LINE__, basedir(__FILE__), $sql); 
} 

while ( $row = $db->sql_fetchrow($result) ) 
{ 
   $forum_name = $row['forum_name']; 
   if ($row["auth_read"] < 1) 
   { 
   //note, we have the code de-tabbed like this to provide a cleaner output... 
   echo ' 
   <url> 
      <loc>'.$baseURL.append_sid('viewforum.php?f='.htmlspecialchars($row["forum_id"])).'</loc> 
      <changefreq>daily</changefreq> 
      <priority>0.8</priority> 
   </url>'; 
   } 
   else 
   { 
      //add fourm_id of the one here to an array 
      $hidtopic[]= $row["forum_id"]; //ok, we now have populated the array with the fourm_ID of the hidden topics 
   } 
} 

//ok, now we mod the below so that it reads fourm_id as well 
$sql = "SELECT t.topic_title, t.topic_id, t.topic_replies, t.forum_id, p.post_time 
   FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p 
   WHERE p.post_id = t.topic_last_post_id 
   ORDER BY p.post_time DESC"; 

if( !($result = $db->sql_query($sql)) ) 
{ 
   message_die(CRITICAL_ERROR, "Could not query topic information", "", __LINE__, basedir(__FILE__), $sql); 
} 

if( $db->sql_numrows($result) >= 50000 ) 
{ 
   message_die(CRITICAL_MESSAGE, "Sitemap generated will be too large. Please modify file to make multiple sitemaps."); 
} 

$i = 0; 
while($row =  $db->sql_fetchrow($result)) 
{ 
   if ($hidtopic[$i] != $row["forum_id"]) 
   { 
      //if we get here, then the fourm_id of the post in question can be displaied... 
      //same tabbing reason as above 

      //Do tell thee, how many pages does one have? 
      $perpage = $board_config['posts_per_page']; 
      $numpages = intval($row['topic_replies']/$perpage); 

      if ($numpages == 0) 
      { 
         $topic_title = $row['topic_title']; 
         echo ' 
            <url> 
               <loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"])).'</loc>'; 
            if ((time() - $row['post_time']) < 2600000) 
            { 
               echo ' 
                  <lastmod>'.date('Y-m-d',$row['post_time']).'</lastmod> 
                  <priority>0.8</priority> 
               </url>'; 
            } 
            else 
            { 
               echo ' 
                  <changefreq>monthly</changefreq> 
                  <priority>0.5</priority> 
               </url>'; 
            } 
      } 
      else 
      { 
         for ($j = 0; $j < ($numpages+1); $j++) 
         { 
            $topic_title = $row['topic_title']; 
            $start = $j * $perpage; 
            echo' 
               <url> 
                  <loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"]).'&start='.$start).'</loc>'; 
            if ((time() - $row['post_time']) < 2600000) 
            { 
               echo ' 
                  <lastmod>'.date('Y-m-d',$row['post_time']).'</lastmod> 
                  <priority>0.8</priority> 
               </url>'; 
            } 
            else 
            { 
               echo ' 
                  <changefreq>monthly</changefreq> 
                  <priority>0.5</priority> 
               </url>'; 
            } 
         } 
      } 
   } 
$i++; 
} 

$sql = "SELECT u.username, u.user_id FROM ".USERS_TABLE." u WHERE u.user_active = 1 AND u.user_active != '-1' ORDER BY u.user_id ASC"; 
$result = $db->sql_query($sql); 
while( $row = $db->sql_fetchrow($result) ) 
{ 
   echo' 
   <url> 
      <loc>'.$baseURL.append_sid('profile.php?mode=viewprofile&u='.$row['user_id']).'</loc> 
      <changefreq>weekly</changefreq> 
      <priority>0.3</priority> 
   </url>'; 
} 
?> 
</urlset>
<?php
$xml = ob_get_contents();
ob_end_clean();
if( ($handle = fopen('sitemap.xml', 'w')) )
{
	fwrite($handle, $xml);
	fclose($handle);
}
else
{
	echo $xml;
}	
?>
Hier mal eine Version die eine sitemap.xml erstellt.
Einfach per Cronjob alle 24H ausführen lassen am besten irgendwann wenn wenig los ist und gut ist die Sache.

Verfasst: 02.07.2006 15:38
von mgutt
damals als ich noch keine Cronjobs auf meiner Seite ausführen konnte fand ich diese Seite: www.cronjobs.de

Sicher auch für andere interessant.

Gruß