Copied to clipboard

Flag this post as spam?

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


  • Srinivasan 10 posts 80 karma points
    Oct 04, 2019 @ 13:32
    Srinivasan
    0

    Cultiv Search Engine Sitemap

    I installed the Cultiv Search Engine. I added the

    Sitemap: http://localhost:62062/sitemap.aspx
    link in robots.txt Its generated template and macro.but no document type.

    I dont know what i do the next step?

    sitemap.cshtml(template)

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
        @{
            Layout = null;
            Response.ContentType = "text/xml";
        }
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
            @Umbraco.RenderMacro("Sitemap")
        </urlset> 
    

    sitemap.cshtml (macro)

    @using Umbraco.Core.Models
    @using Umbraco.Web
    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    
    @ListChildNodes(Model.Content.AncestorOrSelf(1))
    
    @helper ListChildNodes(IPublishedContent startNode)
    {
        const int maxLevelForSiteMap = 100;
    
        foreach (var node in startNode.Children.Where(x => Umbraco.MemberHasAccess(x.Id, x.Path)).Where(x => !Umbraco.IsProtected(x.Id, x.Path)).Where(x => x.IsVisible()))
        {
            if (node.TemplateId > 0)
            {
                <url>
                    <loc>@node.UrlWithDomain()</loc>
                    <lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod>
                    @{
                        var freq = node.GetPropertyValue<string>("SearchEngineSitemapChangeFreq");
                        var pri = node.GetPropertyValue<string>("SearchEngineSitemapPriority");
                    }
    
                    @if (!string.IsNullOrEmpty(freq))
                    {
                        <changefreq>@freq</changefreq>
                    }
                    @if (!string.IsNullOrEmpty(pri))
                    {
                        <priority>@pri</priority>
                    }
                </url>
            }
    
            if (node.Level <= maxLevelForSiteMap && node.Children.Any())
            {
                @ListChildNodes(node)
            }
        }
    }
    

    enter image description here

Please Sign in or register to post replies

Write your reply to:

Draft