Sitemaps is a Google tool related to website administrators. It is similar to the RSS function of BLOG and is a convenient service. If you submit your own updates in this way, google no longer needs to send so many crawlers to go around. Any website will automatically "notify" Google as long as there is an update to facilitate Google indexing.
It seems that BAIDU has recently started to support sitemap sites in XML format.
Currently, there are many free tools on the network to generate sitemap site maps, which are also convenient to use. The principle is to capture the page you specified, get all the links on the page, and generate a sitemap site map file in xml format based on these links.
However, the disadvantage is that only sitemap with links on the page can be generated. At the same time, the site map must be manually uploaded to the server for use.
The following provides a method to automatically generate a sitemap site map through C #, which can be directly generated in the Server Directory through the website system, in addition, you can set any link that needs to be displayed on the sitemap site map as needed.
Copy codeThe Code is as follows: using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Namespace Voodoo. other. SEO
{
/// <Summary>
/// Generate site map sitemap
// (C) http://aizr.net
/// </Summary>
Public class SiteMap
{
Public List <PageInfo> url
{
Get;
Set;
}
/// <Summary>
/// Generate the SiteMap string
/// </Summary>
/// <Returns> </returns>
Public string GenerateSiteMapString ()
{
StringBuilder sb = new StringBuilder ();
Sb. AppendLine ("<? Xml version = \ "1.0 \" encoding = \ "UTF-8 \"?> ");
Sb. AppendLine ("<urlset xmlns = \" http://www.sitemaps.org/schemas/sitemap/0.9.pdf ">");
Foreach (PageInfo pi in url)
{
Sb. AppendLine ("<url> ");
Sb. AppendLine (string. Format ("<loc >{0} </loc>", pi. loc ));
Sb. AppendLine (string. Format ("<lastmod> {0} </lastmod>", pi. lastmod. ToString ("yyyy-MM-dd ")));
Sb. AppendLine (string. Format ("<changefreq >{0} </changefreq>", pi. changefreq ));
Sb. AppendLine (string. Format ("<priority> {0} </priority>", pi. priority ));
Sb. AppendLine ("</url> ");
}
Sb. AppendLine ("</urlset> ");
Return sb. ToString ();
}
/// <Summary>
/// Save the Site file
/// </Summary>
/// <Param name = "FilePath"> path </param>
Public void SaveSiteMap (string FilePath)
{
Voodoo. IO. File. Write (FilePath, GenerateSiteMapString (); // save it in the specified directory
}
}
Public class PageInfo
{
/// <Summary>
/// URL
/// </Summary>
Public string loc {get; set ;}
/// <Summary>
/// Last Update Time
/// </Summary>
Public DateTime lastmod {get; set ;}
/// <Summary>
/// Update frequency
/// </Summary>
Public string changefreq {get; set ;}
/// <Summary>
/// Priority, 0-1
/// </Summary>
Public string priority {get; set ;}
}
}