|
|
|
|
Sitemaps
|
Sitemaps are a way to tell the major search
engine about all of the pages in your website. Sitemaps can be
produced in a number of different formats, but the XML format allows
additional information to be entered with the Sitemap. The XML
sitemap is of the form:
<?xml version="1.0"
encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.computerrepaircentral.com.au/computerwillnotstart.php</loc>
<lastmod>2008-04-25</lastmod>
<changefreq>Weekly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
|
Sitemaps are particularly an advantage for sites that use forms to
move between pages within a site. Normally search engine bots will
not be able to follow the form links correctly. In any case, the sitemap format helps
the search engine to understand your site better and that can only
be a good thing. Once the sitemap is created it can be manually submitted to
each search engine or it can be included in the robots.txt file with
the line
|
Sitemap: http://www.example.tld/sitemap.xml |
|
There are many programs that will automatically create a sitemap.xml file from your website but after
trying a few programs I wrote a quick VBA version for myself. This version works on the local project
rather than from the website. Put it into any Microsoft program that will run VBA.
Const LocalDirectory = "C:\Users\janosm\Documents\My Web Sites\computer\"
Const Domain = "http://www.computerrepaircentral.com.au/"
Sub main()
Dim oFso As New FileSystemObject
Dim oFolder As Folder
Open LocalDirectory & "sitemap.xml" For Output As #1
Set oFolder = oFso.GetFolder(LocalDirectory)
Print #1, "<?xml version=""1.0"" encoding=""UTF-8""?>"
Print #1, "<urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"">"
OutputFiles oFolder, oFso
Print #1, "</urlset>"
Close #1
End Sub
Sub OutputFiles(oFolder As Folder, oFso As FileSystemObject)
Dim oFile As File
Dim oSubFolder As Folder
Dim ext As String
Dim path As String
For Each oFile In oFolder.Files
ext = oFso.GetExtensionName(oFile.path)
If InStr("html,htm,php", LCase(ext)) <> 0 Then
path = Replace(oFile.path, LocalDirectory, URL)
path = Replace(path, "\", "/")
Print #1, " <url>"
Print #1, " <loc>"; path; "</loc>"
Print #1, " <lastmod>"; Format(oFile.DateLastModified, "yyyy-mm-dd"); "</lastmod>"
Print #1, " <changefreq>Weekly</changefreq>"
Print #1, " <priority>0.5</priority>"
Print #1, " </url>"
End If
Next oFile
For Each oSubFolder In oFolder.SubFolders
If InStr(oSubFolder.Name, "_vti_cnf") = 0 And InStr(oSubFolder.Name, "reports") = 0 Then
OutputFiles oSubFolder, oFso
End If
Next oSubFolder
End Sub
|
In the references section select the Microsoft Scripting Runtime. This allows the filesystemobject object
which is used for iterating through the folders.
All you need to do to the code is change the constants in the first two lines to point to the folder that contains
the web project for your site and the target web site. Run the program and it will create a file called sitemap.xml in
the root directory of your project.
If you need a professional
computer technician
|
Computer Repair Central
Power problems for your PC
Computer will not start
How to get a Search Engine to find you
Automatically create a Sitemap for a Search Engine
|