Idea: new category for sharing working code snippets
It would be great to have a section ion the page or in the forum to share code snippets without making a package out of it. For example, I wrote this yesterday, it is very simple - however maybe someone else could use it as well.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet makes a breadcrumb of parents using an html ordered list.
It makes metadata available for search engines in the Microdata format.
The CSS is customised for Bootstrap 4
*@
@if (CurrentPage.Ancestors().Any())
{
dynamic pageAncestors = CurrentPage.AncestorsOrSelf().OrderBy("Level");
string cssClass = "breadcrumb-item";
<div>
<ol class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
@foreach (var page in pageAncestors)
{
if (page.level == pageAncestors.Count()) { cssClass = "breadcrumb-item active"; }
<li class="@cssClass" itemprop="itemListElement" itemscope
itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing"
itemprop="item" href="@page.Url">
<span itemprop="name">@page.Name</span>
</a>
<meta itemprop="position" content="@page.Level" />
</li>
}
</ol>
</div>
}
Idea: new category for sharing working code snippets
It would be great to have a section ion the page or in the forum to share code snippets without making a package out of it. For example, I wrote this yesterday, it is very simple - however maybe someone else could use it as well.
is working on a reply...