+1-888-365-2779
Try Now
More in this section

Forums / Suggestions / Search engine optimization

Search engine optimization

17 posts, 0 answered
  1. Joaquim Pereira
    Joaquim Pereira avatar
    5 posts
    Registered:
    11 Sep 2006
    01 Jun 2007
    Link to this post
    I was wondering if it could be possible for sitefinity to automaticaly generate google's sitemap.xml based on the sitemap that we contruct in sitefinity.
  2. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    04 Jun 2007
    Link to this post
    Hello Joaquin,

    We are planning to implement this in one of the upcoming releases.
    You may find these forum threads worth reading:

    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-gdkbk.aspx
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-tgmhm.aspx

    Regards,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    05 Jun 2007
    Link to this post
    Joaquin -

    We were able to get this to work fairly well. The problem is that for every custom module that you create you need the sitemap file to reflect the different dynamic pages in module. For example if you create a property management database with 100s of listings, each listing should appear in the sitemap automatically. However given the current development this isn't the case. Each module requires that you modify the code for the sitemap generator. Also, if you have 1000s of listings you may want to have the sitemap generator break up your sitemap with index files. Anyway, good luck and please post any fresh ideas that you may have.

    Sincerely,

    Ben
  4. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    07 Jun 2007
    Link to this post
    Hi Joaquin,

    We are thinking over the idea to add google sitemap generator for Sitefinity in one of our next releases. Ben has already done a great job in pointing us to the right direction for some tricky situations and wrote some code which satisfies most of the users needs.

    Our intention is to add some more advanced features to the google sitemap such as taking care of page priority, splitting of sitemap file in parts if needed and so on.

    Let us know if you come up with any other ideas.

    Regards,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    07 Jun 2007
    Link to this post
    It was really Sean Molam's idea and original code that we have been working with.
  6. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    08 Jun 2007
    Link to this post

    Ben, indeed you are right that the original idea was Sean's. Hope he is not angry about that :)

    Kind regards,

    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    14 Jun 2007
    Link to this post
    Hi Guys,

    Thanks for the credit, but really Ben you added more to the Sitemap than I did, I had the basic idea but didn't follow through on it..

    Definitely I am not angry :)  Anything that furthers Sitefinity is only going to help me out too!!

    Cheers
    Sean
  8. NWTResearch
    NWTResearch avatar
    24 posts
    Registered:
    04 Apr 2005
    12 May 2008
    Link to this post
    Hello,

    I was wondering if there was any current updates on adding a Google sitemap generating feature within Sitefinity? It would be a great feature to see!

    Thanks.
  9. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    13 May 2008
    Link to this post
    Hi Darrell,

    There is no update on this yet. We found that the code submitted in this forum thread works fairly well and can be used.
    We should probably discuss this feature request again.

    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. Daniel
    Daniel avatar
    3 posts
    Registered:
    21 May 2008
    22 May 2008
    Link to this post
    Hello,

    I just can't get it to work.
    I have tried this code over and over again.

    What I want is a /sitemap.xml or /sitemap.ashx that shows sitefinitys current sitemap in google sitemap format.

    Could someone please publish some code that will make that happen?

  11. NWTResearch
    NWTResearch avatar
    24 posts
    Registered:
    04 Apr 2005
    22 May 2008
    Link to this post

    Hello Daniel,

    I am not sure if this will be helpful to you but I just went to http://www.xml-sitemaps.com/ and generated one that way.

    Hopefully the ability to generate search engine friendly sitemaps will make it into an upcoming release.

    Thanks.

  12. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    24 May 2008
    Link to this post
    Daniel -

    Here is newer version of the .ashx.

    I haven't really tested it for accuracy and it is still showing the incorrect timezone (note sure why), but it's pumping out xml.

    Also, the priority function doesn't work anymore so I got rid of it. It doesn't work because someone at Sitefinity decided we wouldn't need custom meta tags. I don't like that person. JK there is a post about adding custom meta tags but I haven't had a chance to mess with it yet.

    Also, in my dream world it would just read all of the urls from a generic index of the search service. Then it would go and look up information as needed.
    I spent a couple of hours trying get it to work with lucene api, but no luck yet. That would be a nice way to control what appears in the sitemap. Pages, News, Blogs, Custom Modules would all be in the index. Otherwise you have to do alot of work to get your custom module pages to appear in the sitemap.

    I hope this helps.

    Sincerely,

    bnye

    <%@ WebHandler Language="VB" Class="SiteMap" %>  
    Imports System  
    Imports System.Web  
    Imports System.IO  
    Imports System.Text  
    Imports System.Xml  
     
    Imports Telerik.Search  
    Imports Telerik.Cms  
    Imports Telerik.Cms.data  
    Imports Telerik  
    Imports Telerik.Cms.Engine  
     
    Imports Lucene.Net.Documents  
    Imports Lucene.Net.Search  
     
     
    Public Class SiteMap  
        Implements IHttpHandler  
          
          
          
        Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest  
            Try 
                  
                Dim response As HttpResponse = context.Response  
                response.ContentType = "text/plain" 
              
                Dim writer As New XmlTextWriter(response.OutputStream, Encoding.UTF8)  
              
                writer.Formatting = Formatting.Indented  
                writer.WriteStartDocument()  
                writer.WriteStartElement("urlset")              
                  
     
                'writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")  
                'writer.WriteAttributeString("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd")  
                writer.WriteAttributeString("xmlns""http://www.sitemaps.org/schemas/sitemap/0.9")  
                                                             
                'I'd like to try using searching the index to get the output.  
                'We could find all the pages in generic index and then look up the  
                'CmsPage and append the node.  
                'http://www.aspfree.com/c/a/BrainDump/Working-with-Lucene-dot-Net/4/  
                                                 
                  
                Dim pages As New GetCmsPages  
                pages.LoadAll()              
               
                'Use this part for your custom modules  
                'pages = AppendTestimonials(pages)  
                'pages = AppendNews(pages)  
                  
                For Each page As CmsPage In pages  
                    If page.Status = PageStatus.Published = True Then 
                        AppendNode(page, writer, 0)  
                    End If 
                Next 
                  
              
                writer.WriteEndElement()  
                writer.WriteEndDocument()  
                  
                response.Flush()  
                writer.Flush()  
     
            Catch ex As Exception  
                  
            End Try 
              
        End Sub 
          
        Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable  
            Get 
                Return True 
            End Get 
        End Property 
     
     
        Private Sub AppendNode(ByVal page As CmsPage, ByVal writer As XmlTextWriter, ByVal depth As Integer)  
          
            Try 
                Dim n As CmsPage  
                Dim subNodeDepth As Integer 
                                               
                writer.WriteStartElement("url")  
                writer.WriteElementString("loc", GetURL(page))  
                writer.WriteElementString("lastmod", GetLastMod(page))  
                writer.WriteElementString("changefreq", GetChangeFreq(page))  
                writer.WriteElementString("priority", GetPriority(page))  
                  
                writer.WriteEndElement()  
                  
                subNodeDepth = depth + 1  
                  
                'Not needed because get all pages is called at the beginning.  
                For Each n In page.ChildPages  
                    If page.Navigable = True Then 
                        AppendNode(n, writer, subNodeDepth)  
                    End If 
                Next 
                 
            Catch ex As Exception  
     
            End Try 
        End Sub 
          
        Private Function GetURL(ByVal page As CmsPage) As String 
            Try 
                Dim vars As NameValueCollection = HttpContext.Current.Request.ServerVariables  
                Dim port As String = vars("SERVER_PORT")  
                Dim protocol As String = vars("SERVER_PORT_SECURE")  
                Dim urlResolver As New System.Web.UI.Control  
                Dim url As String 
                  
                If (port Is Nothing Or port = "80" Or port = "443"Then 
                    port = "" 
                Else 
                    port = ":" + port  
                End If 
             
                If (protocol Is Nothing Or protocol = "0"Then 
                    protocol = "http://" 
                Else 
                    protocol = "https://" 
                End If 
                           
                url = page.DefaultUrl.Url  
                Return protocol + vars("SERVER_NAME").ToString + port + urlResolver.ResolveUrl(url)  
             
            Catch ex As Exception  
                Return String.Empty  
            End Try 
        End Function 
          
        Private Function GetLastMod(ByVal page As CmsPage) As String 
            Try 
                                        
                Return Format(page.DateModified, "yyyyy-MM-ddThh:mm:sszzzz")  
            Catch ex As Exception  
                Return String.Empty  
            End Try 
        End Function 
          
        Private Function GetChangeFreq(ByVal page As CmsPage) As String 
            Try 
                Dim intervalString As String = String.Empty  
                Dim intervalLong As Long = DateDiff(DateInterval.Hour, page.DateModified, Now)  
                     
                If intervalLong < 1 Then 
                    intervalString = "hourly" 
                ElseIf intervalLong <= 24 And intervalLong > 1 Then 
                    intervalString = "daily" 
                ElseIf intervalLong <= 168 And intervalLong > 24 Then 
                    intervalString = "weekly" 
                ElseIf intervalLong <= 672 And intervalLong > 168 Then 
                    intervalString = "monthly" 
                ElseIf intervalLong <= 8766 And intervalLong > 672 Then 
                    intervalString = "yearly" 
                End If 
                  
                Return intervalString  
            Catch ex As Exception  
                Return String.Empty  
            End Try 
        End Function 
             
        Private Function GetPriority(ByVal page As CmsPage) As String 
            Try                         
                  
                Return "0.5" 
     
            Catch ex As Exception  
                Return String.Empty  
            End Try 
        End Function      
    End Class 
        




  13. Daniel
    Daniel avatar
    3 posts
    Registered:
    21 May 2008
    25 May 2008
    Link to this post
    Thank you Ben for the updated version of your code for the sitemap.

    Your code does exactly what I wanted to do.

    This is something that really should be delivered in the next version of sitefinity. Everybody needs a working sitemap for SEO.

  14. Daniel
    Daniel avatar
    3 posts
    Registered:
    21 May 2008
    25 May 2008
    Link to this post
    Thanks again for the code.

    The code works, but with som flaws...

    I doesn't write out the language separator ( ex. /en/ /sv/  ).
    Instead i get several <loc></loc>of same urls, even in websites that doesn't have several language.

    Sometimes the same url appears 4 times... sometimes 2 times, and sometimes 1 time, like it should.

    Why is that?

    /Daniel


  15. bnye
    bnye avatar
    332 posts
    Registered:
    22 Sep 2005
    25 May 2008
    Link to this post
    Sorry for the confusion. I think the first of many issues is that you need to comment out the section that says.

    'Not needed because get all pages is called at the beginning.     
                For Each n In page.ChildPages     
                    If page.Navigable = True Then    
                        AppendNode(n, writer, subNodeDepth)     
                    End If    
                Next    
     

    because the query GetCmsPages returns all of the pages there is no need to recursively call the AppendNode() function.

    As far as the language seperator, I have to be honest, I haven't looked at the specs for the sitemap.org in a while. Perhaps you can tell me what's needed and I can modify the code.

    Sincerely,

    bnye
  16. Greg Mattison
    Greg Mattison avatar
    15 posts
    Registered:
    14 Jul 2005
    10 May 2010
    Link to this post
    Hello,

    We've implemented the sitemap.ashx and are receiving errors on the Google Webmaster site after we submitted it. Here is a snippet of the errors it returned.  It says there are a total of 133 urls in the sitemap but it only indexed 36 due to the errors.  When I look at the sitemap that's generated, all the entries look the same so I'm not sure what's going on.  Any ideas?  Obviously, we want to make sure Google is crawling all the urls so all pages show up. 

    Thanks
    -Greg

    5
    Invalid date
    An invalid date was found. Please fix the date or formatting before resubmitting.
    Parent tag: url
    Tag: lastmod
    Value: 02010-05-07T11:30:52-05:00
    Problem detected on: May 7, 2010
    Warnings 11
    Invalid date
    An invalid date was found. Please fix the date or formatting before resubmitting.
    Parent tag: url
    Tag: lastmod
    Value: 02009-07-30T02:42:20-05:00
    Problem detected on: May 7, 2010
    Warnings 17
    Invalid date
    An invalid date was found. Please fix the date or formatting before resubmitting.
    Parent tag: url
    Tag: lastmod
    Value: 02010-01-28T09:46:22-06:00
    Problem detected on: May 7, 2010
    Warnings 23
    Invalid date
    An invalid date was found. Please fix the date or formatting before resubmitting.
    Parent tag: url
    Tag: lastmod
    Value: 02010-01-28T09:40:02-06:00
    Problem detected on: May 7, 2010
  17. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 May 2010
    Link to this post
    Hi Greg Mattison,

    You have a typo in your code producing invalid dates: 02009-07-30T02:42:20-05:00. You should correct your code as instructed in the support ticket.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
17 posts, 0 answered