New blog/post/MOTD notification icon next to title?
Hi peeps!
First post here - hoping someone can help.
I'm currently using 7.5.3 as an intranet for a local gov.
I have a blog-type set up for a Message of the Day and everything is working great.
But... I want to be able to apply a 'New Post' icon on the latest message titles that runs for 24 hours then turns to a standard icon.
I'm currently using a Font Awesome icon next to the post title in the list, and I'm pretty much asking if there's a way to make one icon show for 24 hours and then a different icon show forever after?
Check the Nodes createDate + 1 versus current datetime And change the iconName accordingly
@{
// node is the node you want to check
var isRecent = node.CreateDate.AddDays(1) > DateTime.Now;
var iconName = isRecent ? "fa-snowflake-o" : "fa-asterisk";
}
//Somewhere in your razor
<i class="fa @iconName" aria-hidden="true"></i>
New blog/post/MOTD notification icon next to title?
Hi peeps!
First post here - hoping someone can help.
I'm currently using 7.5.3 as an intranet for a local gov. I have a blog-type set up for a Message of the Day and everything is working great.
But... I want to be able to apply a 'New Post' icon on the latest message titles that runs for 24 hours then turns to a standard icon.
I'm currently using a Font Awesome icon next to the post title in the list, and I'm pretty much asking if there's a way to make one icon show for 24 hours and then a different icon show forever after?
any help would be much appreciated.
thanks
Ben
Check the Nodes createDate + 1 versus current datetime And change the iconName accordingly
Hi Sven, that's exactly what I'm after! so here's my current Partial 'displaying list' block....
Can I put all of that code in this Partial or just the
and run the rest from another place?
Thanks again for your help!
This should work
Welcome to the Umbraco community btw :) you are now one of us!
Don't forget to mark the correct answer so future visitors can easily find it.
Works perfect, you're a star!
thanks for your help :)
is working on a reply...