• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Sitemap Generator

Agreed. It'd be awesome to have a sitemap generator in the core, or via modification/addon. :)
 
For the time being, I've resorted to using a simple python script to manually generate a list of thread urls since google accepts list text files. I don't recommend it for large boards though unless you were running the script on a local installation.

For anyone interested, download Python (http://www.python.org/download/).
Open a new file, copy and paste the code below. Fill out the commented sections (#) and press F5.
Take the resulting file, upload it to your server and submit that as a sitemap in Google Webmaster Tools.

Code:
#!/usr/bin/env python

import urllib2

# path to your xenforo threads directory with the trailing slash
xenpath = "http://www.yourforum.com/threads/"

# largest thread id on your forum (find the newest thread and write down the id number, don't simply copy number listed in Forum Statistics)
totalthreads = 529

# path to save the resulting text file
savepath = "C:/Folder Path/Desired File Name.txt"

filehandle = open(savepath, "w")

print "Working..."

for thread in reversed(range(1, totalthreads+1)):

    try:
        link = xenpath+"a.%s/" % thread
        response = urllib2.urlopen(link)
        url = response.geturl()
        filehandle.write(url+"\n")

    except urllib2.HTTPError, error:
        if error.code == 404:
            print "Thread #", thread, "is a deleted thread."
        else:
            print "Script has been stopped -", error
            raise SystemExit()

filehandle.close()

print "Completed. Results have been saved to", savepath

Can be used on categories and boards too, just fill xenpath with categories and forums paths respectively.
 
Top Bottom