Copied to clipboard

Flag this post as spam?

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


  • Denis 47 posts 68 karma points
    Jan 24, 2012 @ 20:51
    Denis
    0

    Razor script not include Homepage

    I have installed razor version and my homepage is not included in sitemap.

    Structure is as is suggested on umbraco tutorials

    Content
      Homepage
          About us
          Contact 
          ....

    Is it this wrong structuring of pages ?

    xslt is working well if i remove  [@level=1] (it shows in this case homepage)

    I am new in umbraco, and i am going to razor scripting. I do not plan to use xslt ...

    Thank You

  • Jeroen Breuer 4859 posts 12120 karma points MVP 3x admin c-trib
    Jan 24, 2012 @ 21:38
    Jeroen Breuer
    0

    Sorry misread the forum post. Please remove this post :).

  • Denis 47 posts 68 karma points
    Jan 25, 2012 @ 10:50
    Denis
    0

    Question is:

    What i must change in razor script that will include Homepage ...

    Or i use wrong page structure:

    suggested in tutorials, that i use:
    Content
         -Homepage
              -About us
              -Contact
              ....

    and i see that nav, sitemap and other default scripts are prepared for this structure
    Content
         -Homepage
         -About us
         -Contact
         ....

    Please can anyone suggest me what is right page structuring !?

  • Sara Coutinho 4 posts 24 karma points
    Mar 22, 2012 @ 14:10
    Sara Coutinho
    0

    Hi Denis,

    EDIT: previous version was not correct and generated duplicated pages. This one is hopefully correct, not 100% sure as I don't have the same structure as you:

    Paste the following code before calling the helper (on the very beginning):


        @GetUrlWithDomainPrefix(Model.Parent.Url)
       
        @if (Model.Parent.SearchEngineSitemapChangeFreq.ToString() != "")
        {
            @Model.Parent.SearchEngineSitemapChangeFreq
        }
        @if (Model.Parent.SearchEngineSitemapPriority.ToString() != "")
        {
            @Model.Parent.SearchEngineSitemapPriority
        }

    Not the most elegant solution but it works.

    Cheers,
    Sara

  • Anna Placido 3 posts 23 karma points
    Apr 24, 2012 @ 11:30
    Anna Placido
    0

    Hey,

    I had the same issue.  Changing this line:

    @ListChildNodes(Model.AncestorOrSelf(1))

    To this:

    @foreach (Node topNode in new umbraco.NodeFactory.Node(-1).Children)

    {

        if (topNode.GetProperty("umbracoNaviHide").Value != "true")

        {

            <url>

                    <loc>@GetUrlWithDomainPrefix(topNode.Url)</loc>

                    <lastmod>@(string.Format("{0:s}+00:00", topNode.UpdateDate))</lastmod>

                     @if (topNode.GetProperty("searchEngineSitemapChangeFreq") != null)

                     {

                         if (topNode.GetProperty("searchEngineSitemapChangeFreq").ToString() != "")

                         {

                            <changefreq>@topNode.GetProperty("searchEngineSitemapChangeFreq")</changefreq>

                         }

                     }

                     @if (topNode.GetProperty("searchEngineSitemapPriority") != null)

                     {

                         if (topNode.GetProperty("searchEngineSitemapPriority").ToString() != "")

                         {

                            <priority>@topNode.GetProperty("searchEngineSitemapPriority")</priority>

                         }

                     }

     

                </url> 

     

                  var theNode = @Model.NodeById(topNode.Id);

           

              @ListChildNodes(theNode)

        }

    }

    Seemed to do the trick for me!

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft