Google Sitemap & DasBlog

Google Site Map for ASP.NET

Google Sitemap & DasBlog


AerosSaga 08-07-2005, 13:46
I have a dnn installation installed at http://scottschecter.net that I just bought your google sitemap module for. I also have a DasBlog installation at the same ip address at http://blog.scottschecter.net, would it create a google sitemap of my DasBlog installation? I know you pass portal id, would there be any way to get it to work with dasblog?

Thanks

Scott

Re: Google Sitemap & DasBlog


admin 08-07-2005, 16:23

You are licensed for any site on that IP address, so you are 'allowed' to have a version for your DasBlog site.

There are two ways you can do this. 

Firstly, you can create a class that inherits from "LSpaceDesign.GoogleSiteMap.SiteMapLoader" and implement code that reads the DasBlog database and creates an XmlDocument that conforms to the GoogleSiteMap schema.

Secondly, included in the LSpaceDesign.GoogleSiteMap dll is a class called XmlBasedMap, which can take an XML file, and an XSLT file, and uses those to produce an XmlDocument that conforms to the GoogleSiteMap schema.

If you would like the code for generating and populating a schema I'll post and example shortly.


Roger Willcocks
Software Engineer MSCD.NET
L-Space Design
http://www.l-space-design.com/
"Putting your experience to work"

Example of a site map creation method


admin 08-07-2005, 16:58

Example of a site map creation method

public class SampleLoader : LSpaceDesign.GoogleMap.SiteMapLoader {

    public SampleLoader() {

    }

    private static string inPath = ""; //static member variable
 

    public override XmlDocument GetSiteMap()
    {
      if (inPath.Length < 1) //Need to initialize
      {
            lock (typeof(GoogleMap))
            {
                  if (inPath.Length < 1)
                  {
                        try
                        {
                              inPath = "" + ConfigurationSettings.Instance().Settings["SourceXmlFile"];
			      //Hash table of 'extra' settings in provider section of web.config
                              if (inPath.IndexOf(':') < 0)
                              {
                                    XmlBasedMap.inPath = HttpContext.Current.Server.MapPath(XmlBasedMap.inPath);
                              }
                        }
                        catch
                        {
                        }
  
                }
            }
      }
//Set up fixed document structure
      XmlDocument siteMap = new XmlDocument();
      siteMap.AppendChild(siteMap.CreateXmlDeclaration("1.0", "UTF-8", null));
      XmlNode urlSet = siteMap.CreateElement("urlset");
      XmlAttribute ns = siteMap.CreateAttribute("xmlns");
      ns.Value = "http://www.google.com/schemas/sitemap/0.84";
      urlSet.Attributes.Append(ns);
      siteMap.AppendChild(urlSet);
// End set up document


      string defaultChangeFreq = "" + ConfigurationSettings.Instance().Settings["ChangeFreq"];
      if (defaultChangeFreq.Length < 1)
      {
            defaultChangeFreq = "monthly";
      }

	// GET LIST OF VALID URLS HERE
	// You might do DB access, read a file, etc (example uses a PageInfo object)
            ArrayList urls = new ArrayList();

           
            foreach (PageInfo p in urls)
            {
                  if (isValid(p)) //Do a check to determine if you want to include the page
                  {
                        XmlElement nodeChangeFreq = siteMap.CreateElement("changefreq");
			if((p.ChangeFreq == null) || (p.ChangeFreq.Length < 1)) {
	                        nodeChangeFreq.InnerText = defaultChangeFreq;
			} else {
	                        nodeChangeFreq.InnerText = p.ChangeFreq;
			}
                        XmlElement nodePriority = siteMap.CreateElement("priority");
                        nodePriority.InnerText = p.Priority;
                        XmlElement nodeLastMod = siteMap.CreateElement("lastmod");
                        nodeLastMod.InnerText = p.LastModified.ToString("yyyy-MM-dd");
                        XmlElement nodeLoc = siteMap.CreateElement("loc");
                        nodeLoc.InnerText = p.Url;
                        XmlElement nodeUrl = siteMap.CreateElement("url");
                        nodeUrl.AppendChild(nodeLoc);
                        nodeUrl.AppendChild(nodeLastMod);
                        nodeUrl.AppendChild(nodeChangeFreq);
                        nodeUrl.AppendChild(nodePriority);
                        node1.AppendChild(nodeUrl);
                  }
            }
      }
      return siteMap;
    }
}


Roger Willcocks
Software Engineer MSCD.NET
L-Space Design
http://www.l-space-design.com/
"Putting your experience to work"

Re: Example of a site map creation method


AerosSaga 08-07-2005, 17:17
Thanks when I'm done I'll send it back to you in case you wan't to include it or anyone else is interested.

Re: Example of a site map creation method


admin 08-07-2005, 21:51
Much appreciated.  Let me know if I can help in any way.
Roger Willcocks
Software Engineer MSCD.NET
L-Space Design
http://www.l-space-design.com/
"Putting your experience to work"

Re: Example of a site map creation method


Anonymous 03-13-2006, 3:01
could you please provide me web links about the MCSD.NET trainning CBTs on C# Track.
i will be thankful to you

regards
AJ

Re: Example of a site map creation method


admin 03-13-2006, 14:44

MCSD .NET training is basically not relevant now.  Starting in approximately one month it will be replaced by the MCPD Enterprise certification instead.  The exams for that are not yet publically available, and the preparation material is not very good at all.

If you are wanting basic 'parrot' learning, testking.com is a good place to get exam questions from.

If you would prefer to do actual hands on practical testing, there are many hot labs and trainingg exercises available from Microsoft for free.

try this:  http://www.google.com/search?hl=en&q=site%3Amicrosoft.com+hot+lab+free+online+%22C%23%22&meta=

to see links to many examples.

The best option would be to sign up to things like the MSDN Flash.  There are often special notices and offers, such are 2 for 1, or free resit exams, reduced price sftware, etc.


Roger Willcocks
Software Engineer MSCD.NET
L-Space Design
http://www.l-space-design.com/
"Putting your experience to work"
© L-Space Design Limited 2005

Powered by Community Server, by Telligent Systems