Copied to clipboard

Flag this post as spam?

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


  • Tim C 161 posts 528 karma points
    Jun 10, 2020 @ 16:34
    Tim C
    0

    I have not used U,braco for a while and trying to get back into it.

    As a simple test, I created a root document (home page) with child articles and on the template for the home page, tried to list the child documents and link to them. All worked except the child.Url returns '#' which I believe means Umbraco can't calculate the url.

    The child pages are all published and can be previewed, and fields can be seen on the home page list eg 'pageTitle' ecxcept all the hrefs return '#'

    Is there something I am missing?

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    
    
    
    @{
        Layout = "master.cshtml";
    }
    
    @* the fun starts here *@
    
    @section header
    {
    
      <header>
          <div id="logo"><a class="homelogo" href=""><img src = "@Umbraco.Media(1087).Url"></a></div>
      </header>
    
    }
    
    
    
    <div class="contentWrapper">
        <div class="contentInner">
            <div class="content">
    
    
    
    @{
       var homeNode  = Umbraco.Content(1063);
    
       var selectionArticles = homeNode.Children.OrderByDescending(x => x.Id);
    
       foreach (var article in selectionArticles)
       {
    
         <h2>@article.Name</h2>
    
          var aTitle = article.Value("pageTitle");
          var aListingImage = article.Value<IPublishedContent>("listingImage").Url;
          var aPublishedDate = article.Value("publishedDate");
          var aUrl = article.Url;
          <a class="alist" title="@aTitle" href="@article.Url">@article.Url
            <div class="alistText">
                <div class="alistTextTitle">@aTitle</div>
                <div class="alistTextPublishedDate">@aPublishedDate</div>
            </div>
            <div class="alistImage"><img title = "@aTitle" src="@aListingImage"></div>
          </a>
    
       }
    }
    
    
    
    
            </div>
        </div>
    </div>
    
  • Amir Khan 1282 posts 2739 karma points
    Jun 10, 2020 @ 21:06
    Amir Khan
    0

    Might try @Umbraco.TypedContent(article).Url

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Jun 10, 2020 @ 21:37
    Nik
    0

    Hi Tim,

    That looks right to me. If you go to the Settings section of Umbraco and have a look at Published Status, does the cache indicate any errors? It could be worth telling the cache to rebuild to see if that fixes your issue.

    Nik

  • Tim C 161 posts 528 karma points
    Jun 10, 2020 @ 21:41
    Tim C
    1

    Thanks, all.

    I think I might know what is causing this.

    I have discovered errors occurring eg when I click save and publish descendants.

    Turns out my hosting service is runing SQL2008 and I had installed Umbraco 8 - which needs SQL2012, so I am guessing this is all due to SQL errors.

    As this is a new site, I am going to wipe and start again with Umbraco 7.15.5 as the hosting company doesn't provide SQL2012.

    Thanks again

Please Sign in or register to post replies

Write your reply to:

Draft