Seite 1 von 7

Sitemap für "SEO Urls V2"

Verfasst: 26.05.2006 23:59
von Dominik Müller
Hallo zusammen,

gibt es derzeit schon eine Sitemap, welche die "Keywords in URL"-Methode unterstützt? Kenne nur welche, die die normalen Short-URLs verwenden...

Grüße
Dominik

Verfasst: 27.05.2006 10:16
von BananaJoe
Hab auch schon öfters gefragt aber keiner wusste eine Antwort.

Verfasst: 27.05.2006 11:02
von fanrpg
Ich habe eine mir mal gebastelt... mom
hier:

Code: Alles auswählen

<?PHP
/***************************************************************************
*
* Created: Thursday, June 9, 2005 (Second to last day of Uni!)
* Author:   NeoThermic
*
***************************************************************************/

/***************************************************************************
*
* 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_view 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_view"] < 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 DISTINCT topic_title, topic_id, forum_id, topic_replies FROM '.TOPICS_TABLE.' ORDER BY topic_title';

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

if( $db->sql_numrows($result) >= 50000000000 )
{
   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)
      {
	$thread_name = $row['topic_title'];
	$topic_name = $row['topic_title'];
	$topic_title = $row['topic_title'];
   echo '
   <url>
      <loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"])).'</loc>
      <changefreq>daily</changefreq>
	  <priority>0.8</priority>
   </url>';
      }
      else
      {
         for ($j = 0; $j < ($numpages+1); $j++)
         {
		 	$thread_name = $row['topic_title'];
	        $topic_name = $row['topic_title'];
			$topic_title = $row['topic_title'];
         $start = $j * $perpage;
   echo'
   <url>
      <loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"]).'&start='.$start).'</loc>
      <changefreq>daily</changefreq>
	  <priority>0.8</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>daily</changefreq>
	  <priority>0.8</priority>
   </url>';
} 
?>

</urlset>
Ist ne modifizierte Version von der Sitemap von NeoThermic
Demo kann man sich hier angucken : www.fanrpg.com/sitemap.php
Und Google findet die so in Ordnung.

Verfasst: 27.05.2006 11:08
von Dominik Müller
Hallo,

wenn ich die bei mir aufrufe, steht ganz unten in der Sitemap:
Die XML-Seite kann nicht angezeigt werden

Die XML-Eingabe kann nicht angezeigt werden, wenn Stylesheet XSL verwendet wird. Beheben Sie den Fehler und klicken Sie dann auf Aktualisieren, oder wiederholen Sie den Vorgang später.


--------------------------------------------------------------------------------

Ein Semikolon wurde erwartet. Fehler beim Bearbeiten der Ressource 'http://www.schildkroetenforum.net/sitemap.php'. Zeile ...

<loc>http://www.schildkroetenforum.net/profi ... e&u=2</loc>
-----------------------...
Was ist denn das?

Verfasst: 27.05.2006 11:10
von fanrpg
Keine Ahnung bei mir funzt die Sitemap so.
Und Herr G. akzeptiert die auch so.
Was hast du den fürn Browser?

Verfasst: 27.05.2006 19:36
von Dominik Müller
Es lag an dem Profil-Zeugs in der Sitemap. Wie kann ich denn die Topics in umgekehrter Reihenfolge anzeigen lassen, also sodass sie letzten Topics ganz oben in der Liste stehen?

Momentan sieht der Bereich bei mir so aus:

Code: Alles auswählen

$sql = 'SELECT DISTINCT topic_title, topic_id, forum_id, topic_replies FROM '.TOPICS_TABLE.' ORDER BY topic_id';
Was muss ich da ändern?

Grüße
Dominik

Verfasst: 27.05.2006 21:21
von fanrpg

Code: Alles auswählen

$sql = 'SELECT DISTINCT topic_title, topic_id, forum_id, topic_replies FROM '.TOPICS_TABLE.' ORDER BY topic_id DESC';
So muss das dann aussehen!

Verfasst: 29.05.2006 09:18
von BananaJoe
Vielen Dank!!!!!!
Scheint zu funktionieren!! :)

Verfasst: 29.05.2006 10:36
von mgutt
Was soll das denn:

Code: Alles auswählen

if( $db->sql_numrows($result) >= 50000000000 )
:lol:

Verfasst: 29.05.2006 11:30
von DreamPromise
Moin moin

mal ne dummer Frage:
Was bringt mir eine solche sitemap.php ???

Ich hab mal bei mir eine solche Seite erstellt.
Leider kommt unten:
Die XML-Seite kann nicht angezeigt werden

Die XML-Eingabe kann nicht angezeigt werden, wenn Stylesheet XSL verwendet wird. Beheben Sie den Fehler und klicken Sie dann auf Aktualisieren, oder wiederholen Sie den Vorgang später.


--------------------------------------------------------------------------------

Ein Semikolon wurde erwartet. Fehler beim Bearbeiten der Ressource 'http://www.forum-gartenfreunde.de/sitemap.php'. Zeile ...

<loc>http://www.forum-gartenfreunde.de/profi ... e&u=2</loc>
----------------------...
"b"> <priority>0.8</priority>
</url>
- <url>
<loc>http://www.forum-gartenfreunde.de/ftopic7.html</loc>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
- <url>
<DIV
Hat da jemand eine Idee ??

Danke

DP