Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm not sure what I'm doing wrong here, but for some reason unpublished items are showing in my list. It's a really simple macro that just shows all news items.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using Umbraco.Core.Models.PublishedContent @using Umbraco.Web @{ var selection = Model.Content.ChildrenOfType("newsItem") .Where(x => x.IsVisible()) .OrderByDescending(x => x.Value<DateTime>("datePublished")) .ToArray();} @if (selection.Length > 0) { foreach (var item in selection) { <p><strong><a href="@item.Url">@item.Value("title")</a></strong><br /> <span class="text-muted">@(item.Value<DateTime>("datePublished").ToString("ddd, dd MMMM yyyy"))</span></p> } }
Am I missing something in my .Where?
That looks fine but have you tried to republish the entire site by right clicking on the content folder to rebuild the cache?
I couldn't see that when I right clicked, but found the following under the settings tab. I clicked every one of them, but didn't have any success:
I tried this too. Also no luck.
Hello,
1.What does it show for published date ? for the non published items. 2. did the news items , published and then unpublished?
Some of the items are brand new and never been published. Some of the items were published then unpublished. It's the same for both..
Here's a screenshot of all the data for one of the items showing.
There is no link to the item in the list as it's unpublished and just goes to a #, but it's on the list.
If I name the node to start from explicitly, it gets rid of the unpublished ones.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @using Umbraco.Core.Models.PublishedContent @using Umbraco.Web @{ var selection = Umbraco.Content(Guid.Parse("43c3def7-83c0-42f0-a72d-641bfd79c427")) .ChildrenOfType("newsItem") .Where(x => x.IsVisible()) .OrderByDescending(x => x.Value<DateTime>("datePublished")) .ToArray(); } @if (selection.Length > 0) { foreach (var item in selection) { <p><strong><a href="@item.Url">@item.Value("title")</a></strong><br /> <span class="text-muted">@(item.Value<DateTime>("datePublished").ToString("ddd, dd MMMM yyyy"))</span></p> } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Unpublished items showing
I'm not sure what I'm doing wrong here, but for some reason unpublished items are showing in my list. It's a really simple macro that just shows all news items.
Am I missing something in my .Where?
That looks fine but have you tried to republish the entire site by right clicking on the content folder to rebuild the cache?
I couldn't see that when I right clicked, but found the following under the settings tab. I clicked every one of them, but didn't have any success:
I tried this too. Also no luck.
Hello,
1.What does it show for published date ? for the non published items. 2. did the news items , published and then unpublished?
Some of the items are brand new and never been published. Some of the items were published then unpublished. It's the same for both..
Here's a screenshot of all the data for one of the items showing.
There is no link to the item in the list as it's unpublished and just goes to a #, but it's on the list.
If I name the node to start from explicitly, it gets rid of the unpublished ones.
is working on a reply...