Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Urvish 252 posts 776 karma points
    Oct 14, 2014 @ 14:05
    Urvish
    0

    Sitemap not generated

    Hi All,

    I have installed CultivSearchEngineSitemap_2.0.1 package in Umbraco 6.0.5.

    I made a page with CultivSearchEngineSitemap template.

    But site map is not generating properly. See below output I am getting.

    enter image description here

    This package is untested in 6.0.x version.

    Is there any way to run that package in 6.0.5.

    Thanks in advance.

    Regards,

    Urvish

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Oct 14, 2014 @ 16:17
    Jan Skovgaard
    0

    Hi Urvish

    Do you know what the code for the macro looks like? Could you post it in here perhaps? (Can't remember how this package works but perhaps I can get an idea by looking at some code).

    /Jan

  • Urvish 252 posts 776 karma points
    Oct 15, 2014 @ 06:23
    Urvish
    0

    Hi Jan,

    Below is the CultivSearchEngineSitemap.xslt code.

    enter image description here

    Sorry code is not properly displayed , so I put image of xslt file.

    Thanks.

    Urvish

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Oct 15, 2014 @ 07:07
    Dennis Aaen
    0

    Hi Urvish,

    From the screenshot that you have posted in your post I can see that you have downloaded and installed the XSLT version of this package, the reason why this is not working is because the XSLT file is written for the old XML schema.

    If you see on the page for the Cultiv Search Engine Sitemap, package, there are two types of the package an XSLT version and the Razor version. Try to uninstall the version of the package that you have installed now, After that try to install the razor editor of the package and see if it goes better.

    You can download the razor editon of this package here

    Hope this helps,

    /Dennis

  • Urvish 252 posts 776 karma points
    Oct 15, 2014 @ 08:24
    Urvish
    0

    Hi Dennis,

    Thanks.

    I have uninstalled XSLT version and install Razor version.

    But result remains same as above mentioned.

    And one thing is that my defaultRenderingEngine is WebForms.

    So will it make and diff?

    Urvish

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Oct 15, 2014 @ 08:56
    Dennis Aaen
    0

    Hi Urvish,

    I have just tried setting up an fresh Umbraco 6.0.5 installation and defaultRenderingEngine is set to WebForms.

    I installed the package, and after the install the package, I visited the url: http://www.yourdomain.com/CultivSearchEngineSitemap. But I got and error on the scripting macro file.

    But with this code you should be good, so try go to the developer section and find the script files folder and find the CultivSearchEngineSitemap.cshtml, in this file, try overwrite content of the file with this one I have pasted:

    @ListChildNodes(Model.AncestorOrSelf(1))

    @helper ListChildNodes(dynamic startNode)
    {
        Response.ContentType = "text/xml";
        const int maxLevelForSiteMap = 100;
       
       
        foreach (var node in startNode.Children
            .Where("HasAccess")
            .Where("!IsProtected")
            .Where("umbracoNaviHide == false")
          )
        {    
            if(node.template > 0) {
                <url>
                    <loc>@GetUrlWithDomainPrefix(node.Url)</loc>
                    <lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod>
                    @if (node.SearchEngineSitemapChangeFreq.ToString() != "")
                    {
                        <changefreq>@node.SearchEngineSitemapChangeFreq</changefreq>
                    }
                    @if (node.SearchEngineSitemapPriority.ToString() != "")
                    {
                        <priority>@node.SearchEngineSitemapPriority</priority>
                    }
                </url>
            }
               
           if (node.Level <= maxLevelForSiteMap && node.ChildrenAsList.Count() > 0)

            {
                @ListChildNodes(node)
            }
        }
    }

    @functions {
        private static string GetUrlWithDomainPrefix(string url) {
            if (url.StartsWith("/"))
              url = url.Substring(1);
                                                                 
            var domainPrefix = string.Format("http://{0}/", HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);
                                                                 
            if (url.StartsWith(domainPrefix))
                return url;
            else
                return domainPrefix + url;
        }
    }

    You can give the template a new name and alias to get the url of the sitemap shorter. I have tried with sitemap, and it works just file. If you do that the url to the sitemap would then be http://www.yourdomain.com/sitemap.

    Hope this helps,

    /Dennis

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Oct 16, 2014 @ 09:57
    Dennis Aaen
    0

    Hi Urvish,

    Did you have time to try, to use the code in my previous post, and see if you can get the sitemap working with this.

    Looking forward to hear from you.

    /Dennis

  • Urvish 252 posts 776 karma points
    Oct 16, 2014 @ 12:01
    Urvish
    0

    Hi Dennis,

    Sorry for the late reply. I stuck up with the other task.

    I have tried your solution but result remains same.

    Below are the steps I did:

    • Make a new cshtml file with your code and Macro related to that.
    • Make new template which call the new macro.
    • Make a new page with new name sitemap and give new template's reference.

    enter image description here

    Let me know if you need more clarity for the same.

    Thanks.

    Urvish

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Oct 16, 2014 @ 13:21
    Dennis Aaen
    0

    Hi Urvish,

    If it can be at any help I would love to create a user and let you into my Umbaco installation where I got it working.

    You can send me an email at denaaen[at]gmail.com, then I can provide you a link and let you into the backoffice.

    Hope this helps,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft