Modified the RSS feed script to build a sitemap, some observations

Posted at 10:04:49 AM in BP Blog (7) | Read count: 3705

One thing I noted in the RSS script for BP Blog is that it builds a text file used for RSS feeds. It limits the number of entries in the file to 10 which wouldn't work for a sitemap. But it does build a file and it builds it when changes are made to the site. There is a link to update RSS on the blog update page, but it also runs when you add a new blog entry which would be an ideal time to create sitemaps.

My blog is integrated into the rest of my web site, albeit; the CSS is all jacked up. My main page lists the last 10 blog entries so anytime I update the blog, the main page is updated. I created the sitemap in xml format from a sitemap generator web site to get an idea of what the file would look like. In the header there is a link to the definition of the sitemap standard (http://www.sitemaps.org/schemas/sitemap/0.9) which I also used. 

Basically, the header stays the same and the loop through the blog table provided in the RSS script is all that was needed to create a sitemap. After I tested the sitemap script by itself and confirmed that it worked (the date format in the RSS script was not compatible with the sitemap, so I had to redefine that function), I removed all the redundant code that was already in the RSS script and then added the sitemap script to the RSS script as an include file. Now every time the RSS feed is run, I build a new sitemap file which is basically every time I update my blog.

Written by Leonard Rogers on Saturday, June 22, 2013 | Comments (0)


    Name
    URL
    Email
    Email address is not published
    Remember Me
    Comments

    CAPTCHA Reload
    Write the characters in the image above