#1
  1. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    May 2018
    Posts
    15
    Rep Power
    0

    Sitemap for a dynamic website


    Hi All,

    I am having a website in which Blog section and few more pages are updated regularly. In that case, it is quite annoying to change the sitemap regularly on addition of new webpage.

    I heard that there are some ways by which I can get my website's sitemap updated regularly by using some sort of php script.

    I know one method of using plugins but I don't want to use them as I am eager to learn new ways.

    So, if anyone of you knows how to do that it would mean a lot.

    Thanks
  2. #2
  3. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Nov 2017
    Location
    Colorado
    Posts
    105
    Rep Power
    10
    When pages are updated regularly, it does not mean you have to update sitemap. Sitemap and Search Engine Submissions are two different things, dont get confused.
  4. #3
  5. SEO Since 97
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    8,397
    Rep Power
    5343
    No need for a site map if your already being spidered. Rookie

    Comments on this post

    • Sandy2012 : source: https://support.google.com/webmasters/answer/156184?hl=en
  6. #4
  7. Moderator
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Sep 2016
    Location
    United Kingdom
    Posts
    1,305
    Rep Power
    1205
    Yeah, I just checked Google and there is PHP scripts which automatically updates sitemaps. Just look around, you'll find the right one for you, or you could pay someone to make you a custom script. It's not a huge script so I doubt it would be much.

    This is what I found:

    Code:
    <?php
      header('Content-type: application/xml');
    
      require_once '../common/settings.php'; // database settings
      require_once PROJECT_PATH . '/lib/php_adodb_v5.18/adodb.inc.php';
      require_once PROJECT_PATH . '/lib/small_blog_v0.8.0/smallblog.php'; // custom blogging engine
      require_once PROJECT_PATH . '/lib/utils/utils.php'; // utility functions: date_decode, now
    
    // configuration
      $url_prefix = 'yourdomain.com';
      $blog_timezone = 'UTC';
      $timezone_offset = '+00:00';
      $W3C_datetime_format_php = 'Y-m-d\Th:i:s'; // See Date and Time Formats
      $null_sitemap = '<urlset><url><loc></loc></url></urlset>';
    
      $blog = new smallblog();  // custom blogging engine
      $res = $blog->db_connect($blog_db_settings);
      if($res === false) {
        echo $null_sitemap;
        exit; // Database connection error...
      } else {
    
        // get all posts meta-data
        $posts = $blog->getPosts(0, 0, '', '', '', now($blog_timezone));
        if($posts === false) {
          echo $null_sitemap;
          exit; // Error retreiving posts...
        }
    
        $len = count($posts);
        for($i = 0; $i < $len; $i++) {
          // entities encode URL according http://www.sitemaps.org/protocol.html#escaping
          $posts[$i]['url'] = $url_prefix . htmlspecialchars($posts[$i]['url']);
          // convert dates to W3C datetime format http://www.sitemaps.org/protocol.html#xmlTagDefinitions
          $posts[$i]['date_updated'] = date_decode($posts[$i]['date_updated'], $blog_timezone, $W3C_datetime_format_php) . $timezone_offset;
        }
    
        // retrieve max date
        $max_date = $posts[0]['date_updated'];
      }
    
      $output = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
      $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
      echo $output;
    ?>
    <url>
      <loc>yourdomain.com/blog/</loc>
      <lastmod><?php print $max_date ?></lastmod>
      <changefreq>daily</changefreq>
    </url>
    <url>
      <loc>yourdomain.com/blog/archive/</loc>
      <lastmod><?php print $max_date ?></lastmod>
      <changefreq>daily</changefreq>
    </url>
    <?php for($i = 0; $i < $len; $i++) { ?>
    <url>
      <loc><?php print $posts[$i]['url'] ?></loc>
      <lastmod><?php print $posts[$i]['date_updated'] ?></lastmod>
    </url>
    <?php } ?>
    </urlset>
    
    

    I got this from here.


    Saying that, like test-ok has pointed out - you don't really need a sitemap, if your internal linking is good enough then you'll be fine without one. The only time a sitemap is really needed is for orphan pages. I'm pretty sure another member called Chedders did a practical test to prove this theory (that there's no advantage) and there wasn't.
    Last edited by matt1966; Jun 19th, 2018 at 04:27 AM.
  8. #5
  9. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    May 2018
    Posts
    15
    Rep Power
    0
    Originally Posted by evejones
    When pages are updated regularly, it does not mean you have to update sitemap. Sitemap and Search Engine Submissions are two different things, dont get confused.
    I don't want that for search engine submission. I just want that whenever a crawler enters my domain, it gets all the URLs at single place(sitemap) and that is what sitemap is for. Isn't it?
  10. #6
  11. No Profile Picture
    Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Nov 2012
    Posts
    167
    Rep Power
    228
    Originally Posted by matt1966
    I'm pretty sure another member called Chedders did a practical test to prove this theory (that there's no advantage) and there wasn't.
    I'd like to be enlightened on this one and would be happy to be redirected to the write-up
  12. #7
  13. SEO Since 97
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    8,397
    Rep Power
    5343
    Originally Posted by Sandy2012
    I'd like to be enlightened on this one and would be happy to be redirected to the write-up
    Either you understand it or you dont, sounds like you dont, which makes you a rooky.
  14. #8
  15. No Profile Picture
    Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Nov 2012
    Posts
    167
    Rep Power
    228
    Originally Posted by Test-ok
    ...which makes you a rooky.
    Hahahah. There is no shame in being a rookie. Everyone has got to start somewhere and last time I checked, this forum is also for beginners so it's all good. Hmmm... You can't be this bad... Either it's all a prank or the entire thing is really just laughable.

    Anyways, in case others (too) misunderstand, I was referring to "Chedder's test" which was mentioned by matt1966. I'd like to learn (be enlightened) about "that test" and would be happy to be redirected to the post that has a discussion of the findings. I'll never be able to understand it unless you point me to that post. I can do a search, but I'd still need confirmation after so I better just ask for the link directly.

    Peace! )

Similar Threads

  1. Sitemap issue for Dynamic Website
    By Gaurav Thandel in forum New User SEO Questions and Answers
    Replies: 7
    Last Post: May 23rd, 2017, 02:28 PM
  2. What is difference between dynamic sitemap and static sitemap?
    By juliacates1 in forum Search Engine Optimization
    Replies: 5
    Last Post: Aug 3rd, 2011, 12:06 AM
  3. Replies: 2
    Last Post: Aug 7th, 2006, 10:44 AM
  4. Replies: 0
    Last Post: Jul 30th, 2006, 01:04 AM

IMN logo majestic logo threadwatch logo seochat tools logo