News:

Wondering if this will always be free?  See why free is better.

Main Menu

Google Sitemaps

Started by Davilac, June 05, 2005, 10:17:49 AM

Previous topic - Next topic

daZiiii_boi

Hey I've just created my first SMF forum while maintaining my main website, I'm very interested in this Sitemap business, I created my account a month back and visited back this morning then saw this topic.

so I went to the website for creating this file we all need if thats right?
http://www.auditmypc.com/free-sitemap-generator.asp [nofollow]

Then in the options on the top I simply input
http://www.studentsintheuk.com/ [nofollow]

and clicked crawl at the moment it's still crawling, now this seems to be going on for a while do I just direct the Java app to the main directory of my website?

I have my main site:
http://www.studentsintheuk.com [nofollow]
Photos page:
http://www.studentsintheuk.com/cpg135/index.php [nofollow]
Forum:
http://studentsintheuk.com/forum/index.php [nofollow]

So do I put all three off these seperate in the Google sitemaps then simply input each individual and upload the file the java app makes into each directory.

Sorry for the all so many questions just want to make sure this is right at the moment it's saying 5000+ on the queued location < is this way to big?

All I would like is for mainly those 3 places on my site to be seen, please indicate in a numerical order rather than paragragh I'm bad at link back and forth so maybe a
1. Do this
2. Do that

hehe I'm so picky sorry just means I don't have to ask and ask again.
Hopefully someone can help me out! Cheers in advance.
And feel free to sing up if your a student!
daZiiii_boi

maxmax

ouch ! i got this error using your sitemap.php

Parse error: parse error, unexpected T_VARIABLE in xxxx/forum/SSI.php on line 739

of course i'm using googlebot mod

i'm on 1.1b3p cause of non finished french translation

i've read the 6pages but i didn't find the solution ? am I blind or there's no solution except removing the googlebot mod?

Davilac

are you sure your SSI.php es well? this seems SSI is corrupted

maxmax

I used to install googlebot manually, so i restore backups, of course the sitemap rules :)

i will try tonight install the bot by the admin panel, but i need some chown by the admin......

thanks  ;D


desistyle

Quote from: Davilac on November 27, 2005, 03:19:12 AM
Quote from: desistyle on November 26, 2005, 09:28:55 PM
Quote from: JayBachatero on November 26, 2005, 09:18:44 PM
It looks good.  That's how its supposed to look.  Just feed the link to google sitemaps website.

isnt it suppose to show all my topics ? like the topic headings and stuff i have 2000 posts isnt that suppose to come just askin ?

I've got what you want. This is working fine for my site. Actually I have this and the other one in this topic, cause you can use as many sitemaps as you want for as many pages you want. You must only modify the variable totaldetopics to fit your forum:

<?php

require_once('SSI.php');

$totaldetopics=5000;

if (
$modSettings['smfVersion'] < '1.1')
ob_start('ob_sessrewrite');

header('Content-Type: text/plain');

echo 
'<?xml version="1.0" encoding="UTF-8"?' '>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'
;

$request db_query("
SELECT posterTime
FROM 
{$db_prefix}messages
WHERE ID_MSG >= " 
. ($modSettings['maxMsgID'] - 30) . "
ORDER BY ID_MSG DESC
LIMIT 10"
__FILE____LINE__);
$latest_post_times = array(time());
while (
$row mysql_fetch_assoc($request))
$latest_post_times[] = $row['posterTime'];
mysql_free_result($request);

$request db_query("
SELECT ID_BOARD
FROM 
{$db_prefix}boards"__FILE____LINE__);
$boards = array();
while (
$row mysql_fetch_assoc($request))
{
$request2 db_query("
SELECT posterTime
FROM 
{$db_prefix}messages
WHERE ID_BOARD = 
$row[ID_BOARD]. ($modSettings['totalMessages'] > 100000 "
AND ID_MSG >= " 
. ($modSettings['maxMsgID'] * 0.5) : '') . "
ORDER BY ID_MSG DESC
LIMIT 10"
__FILE____LINE__);
$board_post_times = array(time());
while ($row2 mysql_fetch_assoc($request2))
$board_post_times[] = $row2['posterTime'];
mysql_free_result($request2);

$boards[] = array(
'id' => $row['ID_BOARD'],
'times' => $board_post_times,
);
}
mysql_free_result($request);



$request db_query("
SELECT ID_MEMBER
FROM 
{$db_prefix}members
ORDER BY totalTimeLoggedIn DESC
LIMIT 20"
__FILE____LINE__);
$members = array();
while (
$row mysql_fetch_assoc($request))
{
$request2 db_query("
SELECT posterTime
FROM 
{$db_prefix}messages
WHERE ID_MEMBER = 
$row[ID_MEMBER]. ($modSettings['totalMessages'] > 100000 "
AND ID_MSG >= " 
. ($modSettings['maxMsgID'] * 0.5) : '') . "
ORDER BY ID_MSG DESC
LIMIT 10"
__FILE____LINE__);
$member_post_times = array(time());
while ($row2 mysql_fetch_assoc($request2))
$member_post_times[] = $row2['posterTime'];
mysql_free_result($request2);

$members[] = array(
'id' => $row['ID_MEMBER'],
'times' => $member_post_times,
);
}
mysql_free_result($request);

// First, the forum URL.  Highest priority!
echo '
<url>
<loc>'
$scripturl'</loc>
<lastmod>'
posts_max_time($latest_post_times), '</lastmod>
<changefreq>'
posts_to_freq($latest_post_times), '</changefreq>
<priority>1.0</priority>
</url>'
;

// Now the boards!
foreach ($boards as $board)
{
echo '
<url>
<loc>'
$scripturl'/board,'$board['id'], '.0.html</loc>
<lastmod>'
posts_max_time($board['times']), '</lastmod>
<changefreq>'
posts_to_freq($board['times']), '</changefreq>
<priority>'
posts_to_priority(0.8$board['times']), '</priority>
</url>'
;
}

// Popular topics too...

$indice;
for (
$indice=1$indice!=$totaldetopics$indice++)
{
echo '
<url>
<loc>'
$scripturl'/topic,'$indice'.0.html</loc>
<lastmod>'
posts_max_time($topic['times']), '</lastmod>
<changefreq>'
posts_to_freq($board['times']), '</changefreq>
<priority>'
posts_to_priority(0.7$board['times']), '</priority>
</url>'
;
}

// Most active members?
foreach ($members as $member)
{
echo '
<url>
<loc>'
$scripturl'?action=profile;u='$member['id'], '</loc>
<lastmod>'
posts_max_time($member['times']), '</lastmod>
<changefreq>'
posts_to_freq($member['times']), '</changefreq>
<priority>'
posts_to_priority(0.5$board['times']), '</priority>
</url>'
;
}

echo 
'
</urlset>'
;

function 
posts_max_time($post_times)
{
if (empty($post_times) || count($post_times) == 1)
return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00'time() - 3600 24 10);

return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00'max($post_times));
}

function 
posts_to_priority($base$post_times)
{
if (empty($post_times) || count($post_times) == 1)
return sprintf('%1.1f'$base);

$s = (max($post_times) - min($post_times)) / count($post_times);

if ($s 3600 24)
$mod 0.1;
else
$mod 0;

return sprintf('%1.1f'$base $mod);
}

function 
posts_to_freq($post_times)
{
if (empty($post_times) || count($post_times) == 1)
return 'yearly';

$s = (max($post_times) - min($post_times)) / count($post_times);

// Changes more often than every hour.
if ($s 3600)
return 'always';
elseif ($s 3600 12)
return 'hourly';
elseif ($s 3600 24 4)
return 'daily';
else
return 'monthly';
}

?>




HI davilac i was wondering if u can modify this code so it can pick up the topic tittle as well is that possible

Davilac

You mean to do a html sitemap?

I will look at this, I need a html sitemap for both Yahoo! and Msn

desistyle

Quote from: Davilac on December 02, 2005, 04:13:13 AM
You mean to do a html sitemap?

I will look at this, I need a html sitemap for both Yahoo! and Msn

thanks a lot you are awesome and yes i am using ur sitemap u gave me that works preety good thaugh thanks a lot

daZiiii_boi

Can i not have any help  :(

Davilac

Quote from: daZiiii_boi on November 28, 2005, 07:42:24 AM
Hey I've just created my first SMF forum while maintaining my main website, I'm very interested in this Sitemap business, I created my account a month back and visited back this morning then saw this topic.

so I went to the website for creating this file we all need if thats right?
http://www.auditmypc.com/free-sitemap-generator.asp

Then in the options on the top I simply input
http://www.studentsintheuk.com/

and clicked crawl at the moment it's still crawling, now this seems to be going on for a while do I just direct the Java app to the main directory of my website?

I have my main site:
http://www.studentsintheuk.com
Photos page:
http://www.studentsintheuk.com/cpg135/index.php
Forum:
http://studentsintheuk.com/forum/index.php

So do I put all three off these seperate in the Google sitemaps then simply input each individual and upload the file the java app makes into each directory.

Sorry for the all so many questions just want to make sure this is right at the moment it's saying 5000+ on the queued location < is this way to big?

All I would like is for mainly those 3 places on my site to be seen, please indicate in a numerical order rather than paragragh I'm bad at link back and forth so maybe a
1. Do this
2. Do that

hehe I'm so picky sorry just means I don't have to ask and ask again.
Hopefully someone can help me out! Cheers in advance.
And feel free to sing up if your a student!
daZiiii_boi

First: You use my code or the official one or both (you then use 2 sitemaps), paste it into a file on your forum's root directory.
Second: You go to http://www.google.com/webmasters/sitemaps and you add a sitemap
Three: Now you have a sitemap for your forum, then you must think about the rest of your site. Search a sitemap generator.

daZiiii_boi

Quote<?php

require_once('SSI.php');

$totaldetopics=5000;

if ($modSettings['smfVersion'] < '1.1')
   ob_start('ob_sessrewrite');

header('Content-Type: text/plain');

echo '<?xml version="1.0" encoding="UTF-8"?' . '>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84 [nofollow]">';

$request = db_query("
   SELECT posterTime
   FROM {$db_prefix}messages
   WHERE ID_MSG >= " . ($modSettings['maxMsgID'] - 30) . "
   ORDER BY ID_MSG DESC
   LIMIT 10", __FILE__, __LINE__);
$latest_post_times = array(time());
while ($row = mysql_fetch_assoc($request))
   $latest_post_times[] = $row['posterTime'];
mysql_free_result($request);

$request = db_query("
   SELECT ID_BOARD
   FROM {$db_prefix}boards", __FILE__, __LINE__);
$boards = array();
while ($row = mysql_fetch_assoc($request))
{
   $request2 = db_query("
      SELECT posterTime
      FROM {$db_prefix}messages
      WHERE ID_BOARD = $row[ID_BOARD]" . ($modSettings['totalMessages'] > 100000 ? "
         AND ID_MSG >= " . ($modSettings['maxMsgID'] * 0.5) : '') . "
      ORDER BY ID_MSG DESC
      LIMIT 10", __FILE__, __LINE__);
   $board_post_times = array(time());
   while ($row2 = mysql_fetch_assoc($request2))
      $board_post_times[] = $row2['posterTime'];
   mysql_free_result($request2);

   $boards[] = array(
      'id' => $row['ID_BOARD'],
      'times' => $board_post_times,
   );
}
mysql_free_result($request);



$request = db_query("
   SELECT ID_MEMBER
   FROM {$db_prefix}members
   ORDER BY totalTimeLoggedIn DESC
   LIMIT 20", __FILE__, __LINE__);
$members = array();
while ($row = mysql_fetch_assoc($request))
{
   $request2 = db_query("
      SELECT posterTime
      FROM {$db_prefix}messages
      WHERE ID_MEMBER = $row[ID_MEMBER]" . ($modSettings['totalMessages'] > 100000 ? "
         AND ID_MSG >= " . ($modSettings['maxMsgID'] * 0.5) : '') . "
      ORDER BY ID_MSG DESC
      LIMIT 10", __FILE__, __LINE__);
   $member_post_times = array(time());
   while ($row2 = mysql_fetch_assoc($request2))
      $member_post_times[] = $row2['posterTime'];
   mysql_free_result($request2);

   $members[] = array(
      'id' => $row['ID_MEMBER'],
      'times' => $member_post_times,
   );
}
mysql_free_result($request);

// First, the forum URL.  Highest priority!
echo '
   <url>
      <loc>', $scripturl, '</loc>
      <lastmod>', posts_max_time($latest_post_times), '</lastmod>
      <changefreq>', posts_to_freq($latest_post_times), '</changefreq>
      <priority>1.0</priority>
   </url>';

// Now the boards!
foreach ($boards as $board)
{
   echo '
   <url>
      <loc>', $scripturl, '/board,', $board['id'], '.0.html</loc>
      <lastmod>', posts_max_time($board['times']), '</lastmod>
      <changefreq>', posts_to_freq($board['times']), '</changefreq>
      <priority>', posts_to_priority(0.8, $board['times']), '</priority>
   </url>';
}

// Popular topics too...

$indice;
for ($indice=1; $indice!=$totaldetopics; $indice++)
{
   echo '
   <url>
      <loc>', $scripturl, '/topic,', $indice, '.0.html</loc>
      <lastmod>', posts_max_time($topic['times']), '</lastmod>
      <changefreq>', posts_to_freq($board['times']), '</changefreq>
      <priority>', posts_to_priority(0.7, $board['times']), '</priority>
   </url>';
}

// Most active members?
foreach ($members as $member)
{
   echo '
   <url>
      <loc>', $scripturl, '?action=profile;u=', $member['id'], '</loc>
      <lastmod>', posts_max_time($member['times']), '</lastmod>
      <changefreq>', posts_to_freq($member['times']), '</changefreq>
      <priority>', posts_to_priority(0.5, $board['times']), '</priority>
   </url>';
}

echo '
</urlset>';

function posts_max_time($post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00', time() - 3600 * 24 * 10);

   return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00', max($post_times));
}

function posts_to_priority($base, $post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return sprintf('%1.1f', $base);

   $s = (max($post_times) - min($post_times)) / count($post_times);

   if ($s < 3600 * 24)
      $mod = 0.1;
   else
      $mod = 0;

   return sprintf('%1.1f', $base + $mod);
}

function posts_to_freq($post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return 'yearly';

   $s = (max($post_times) - min($post_times)) / count($post_times);

   // Changes more often than every hour.
   if ($s < 3600)
      return 'always';
   elseif ($s < 3600 * 12)
      return 'hourly';
   elseif ($s < 3600 * 24 * 4)
      return 'daily';
   else
      return 'monthly';
}

?>


The above coding is that your coding?
Then what do I name the file?

Quote(you then use 2 sitemaps)

Is that creating a Sitemap for:
http://studentsintheuk.com/forum/ [nofollow]
Then do I click  Add a Sitemap beside the  http://studentsintheuk.com/forum/ [nofollow] ?
What do I put as the sitemap url is this were I would put the Code you specified?

Sorry about the questions it's just I'm getting mixed up with all the quotes from others.

Thanks for replying  :D

Davilac

Yes, that's my code. Use it with a file named as you want .php Then you must change the number and put instead your forum's topic count, and put it in your forum's root (that code is only for pretty URLs) and then you can go to Google, add Sitemap and tell him the url where is the sitemap

daZiiii_boi

Quotefunction posts_max_time($post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00', time() - 3600 * 24 * 10);

   return gmstrftime('%Y-%m-%dT%H:%M:%S+00:00', max($post_times));
}

function posts_to_priority($base, $post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return sprintf('%1.1f', $base);

   $s = (max($post_times) - min($post_times)) / count($post_times);

   if ($s < 3600 * 24)
      $mod = 0.1;
   else
      $mod = 0;

   return sprintf('%1.1f', $base + $mod);
}

function posts_to_freq($post_times)
{
   if (empty($post_times) || count($post_times) == 1)
      return 'yearly';

   $s = (max($post_times) - min($post_times)) / count($post_times);

I can find 5 counts within the coding at the button which one do I change? Sorry I just don't want to get this wrong  8) thanks for the help so far  :P

Davilac

You must change $totaldetopics (at the beginning) to fit your forum's

Elijah Bliss

Works fine for me, all I need to do is submit it, but has anyone using this notice any improvement in their google ranking/indexing so far?

Elijah Bliss

#95
Quote from: [Unknown] on July 04, 2005, 03:37:01 PM
You can add ob_start('ob_sessrewrite'); to the top of the file (after the include) if you want queryless URLs.

For more topics, yes... you cna do that.

-[Unknown]

queryless urls for the site map no longer work in RC1 1.1

EDIT: No big deal, I just manually edited them.

Davilac

Sitemaps increases your visits, not for improving your rankings, but for improving your indexing very good. Also you can try an urllist for Yahoo!, which works fine for me.

desistyle

Quote from: Davilac on December 05, 2005, 01:39:07 AM
Sitemaps increases your visits, not for improving your rankings, but for improving your indexing very good. Also you can try an urllist for Yahoo!, which works fine for me.

davilac just wondering if u can make something like this http://forums.hamarabollywood.com/sitemap.html <<

Davilac

That's exactly what I want to improve my indexing. I think I can do it, but give mesome time. Also a coder help would be great.

Davilac

OK, I will release something which will make you happy  :D

Advertisement: