timgolding
09-20-2007, 04:01 PM
Hello,
I have a sitemap on our home page http://jamies.org.uk/sitemap.xml. I am trying to create a PHP script that updates the XML file as I make changes to the layout of the site. Basically some of the static HTML pages on the site are created using a local administration system, that creates static HTML pages, however I want the script to dynamically update the XML so that the links to the newly created pages are added to the site map.
All the pages that could change are after a certain point on the XML. I will need a script to read the existing sitemap file to a string, truncate all the links to pages that have been updated then write the new pages information back to the sitemap file.
One way I could do this is by putting a comment line in from just before all the content that will be changed. The snippet below shows exactly where the comment line would go. I could then read the sitemap file to a string. explode the string to give two seperate entities: above and below. I would then truncate everything below the comment line and replace with the new XML content.
<url>
<loc>
http://jamies.org.uk/sales/index.php?product_name=xplus
</loc>
<priority>0.7</priority>
<changefreq>monthly</changefreq>
</url>
<!-- Static Pages Below -->
<url>
<loc>http://jamies.org.uk/training/index.php?code=1</loc>
<priority>0.5</priority>
<changefreq>monthly</changefreq>
</url>
This leads me to my question.
Will the Google bot still be able to reference my pages if there is a comment line in the sitemap? I hope it would just ignore comment lines and go to the next line. But I am unsure.
I have a sitemap on our home page http://jamies.org.uk/sitemap.xml. I am trying to create a PHP script that updates the XML file as I make changes to the layout of the site. Basically some of the static HTML pages on the site are created using a local administration system, that creates static HTML pages, however I want the script to dynamically update the XML so that the links to the newly created pages are added to the site map.
All the pages that could change are after a certain point on the XML. I will need a script to read the existing sitemap file to a string, truncate all the links to pages that have been updated then write the new pages information back to the sitemap file.
One way I could do this is by putting a comment line in from just before all the content that will be changed. The snippet below shows exactly where the comment line would go. I could then read the sitemap file to a string. explode the string to give two seperate entities: above and below. I would then truncate everything below the comment line and replace with the new XML content.
<url>
<loc>
http://jamies.org.uk/sales/index.php?product_name=xplus
</loc>
<priority>0.7</priority>
<changefreq>monthly</changefreq>
</url>
<!-- Static Pages Below -->
<url>
<loc>http://jamies.org.uk/training/index.php?code=1</loc>
<priority>0.5</priority>
<changefreq>monthly</changefreq>
</url>
This leads me to my question.
Will the Google bot still be able to reference my pages if there is a comment line in the sitemap? I hope it would just ignore comment lines and go to the next line. But I am unsure.