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>
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.
@:child.Url returning #
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?
Might try @Umbraco.TypedContent(article).Url
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
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
is working on a reply...