Posts

Showing posts from 2022

Umbraco 8 - Calculate number of days past / between two dates

  DateTime parsedDate = DateTime.Parse(item.Value<DateTime>("testimonailDate").ToString("dd MMMM yyyy")); var daysPast = (DateTime.Today - parsedDate).TotalDays;  @if(daysPast == 1)                                                 {                                                     <span class="days-ago">@daysPast  day ago</span>                                                 }                                                 else             ...

Umbraco 9 - Strip HTML and Truncate text output

Image
Umbraco 9 - Strip HTML and Truncate text/html output.  The code below can be used for truncating/shortening text and striping out HTML tags in Umbraco 9 to display shorter text useful for landing pages. Instructions:  Replace "bodyText" with the reference to the property you would like to truncate. Code: Example output:

Umbraco 9 - Left hand sub page navigation code snippet.

Image
Umbraco 9 - Left hand sub page navigation code C# RAZOR snippet.  The code below can be used for left hand navigation in Umbraco 9 to create left hand/sub page navigation.  Instructions:  Create a partial _leftHandNavigation  Reference the partial in your Umbraco template, like this: @Html.Partial("_leftHandNavigation") Code: Example output: https://www.buymeacoffee.com/markdevelopment/umbraco-side-bar-left-hand-navigation