Skip to content

Instantly share code, notes, and snippets.

@arjanwoldring
arjanwoldring / GeneralProperties.cshtml
Created April 2, 2012 10:32 — forked from warrenbuckley/GeneralProperties.cshtml
Umbraco V5 (Partial) - General Properties in @DynamicModel
@inherits RenderViewPage
@using Umbraco.Cms.Web;
<h2>Built in Properties</h2>
<h4>Common</h4>
<p>
<strong>@@DynamicModel.Name</strong><br/>
@DynamicModel.Name
</p>
<p>
@arjanwoldring
arjanwoldring / gist:2127377
Created March 19, 2012 21:47 — forked from warrenbuckley/gist:1958307
ListAllDescendatsFromCurrentPage
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (DynamicModel.Children.Where("umbracoNaviHide != @0", "True").Any())
{
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
@arjanwoldring
arjanwoldring / gist:2127368
Created March 19, 2012 21:46 — forked from warrenbuckley/gist:1957921
List Child Pages From CurrentPage By Doctype
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
@* Get the content type alias we want to filter on from the macro parameter *@
var contentTypeAlias = Model.MacroParameters.contentTypeAlias;
}
@arjanwoldring
arjanwoldring / gist:2127367
Created March 19, 2012 21:46 — forked from warrenbuckley/gist:1957689
List Child Nodes from CurrentPage
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@* Ensure that the rootNode has children, where the property umbracoNaviHide is not True *@
@if(DynamicModel.Children.Where("umbracoNaviHide != @0", "True").Any())
{
<ul>
@arjanwoldring
arjanwoldring / gist:2127359
Created March 19, 2012 21:44 — forked from warrenbuckley/gist:1957541
List Child pages from site root (1st level)
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
@* Walk up the tree from the current page to get the root node *@
var rootNode = DynamicModel.AncestorsOrSelf.Last();
}
@arjanwoldring
arjanwoldring / gist:2127355
Created March 19, 2012 21:43 — forked from warrenbuckley/gist:1933587
Umbraco V5 Example - [MODEL] Loop Children ordered by Name
//Order by Node Name
@foreach (Content child in Model.ChildContent().OrderBy(x => x.Name))
{
<h2>@child.Name</h2>
}
//Order by custom property on node with alias of 'pageTitle'
@foreach (Content child in Model.ChildContent().OrderBy(x => x.Field("pageTitle")))
{
<h2>@child.Name</h2>
@arjanwoldring
arjanwoldring / NewsFeed.cshtml
Created March 19, 2012 21:43 — forked from warrenbuckley/NewsFeed.cshtml
Umbraco V5 Example - News feed from News List (atom and rss)
@*
================= Credit goes to Jorge Lusar for creating this =================
Original's at: https://gist.github.com/jorgelusar
Parameters
FeedItems (int, optional, default 20, number of items to be displayed)
FeedTitle (string, optional, default domain name, the title of the feed)
FeedDescription (string, optional, default domain name, the description of the feed)
Author (string, optional, default 'admin', the author name or website name to ensure the atom feed is valid)
@arjanwoldring
arjanwoldring / SitemapHTML.cshtml
Created March 19, 2012 21:42 — forked from warrenbuckley/SitemapHTML.cshtml
Umbraco V5 Example - Sitemap HTML
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
//Get the current page
var currentPage = DynamicModel;
//Will walk up the tree to the last ancestor node aka RootNode
@arjanwoldring
arjanwoldring / ListChildPagesFromCurrentPage.cshtml
Created March 19, 2012 21:42 — forked from warrenbuckley/ListChildPagesFromCurrentPage.cshtml
Umbraco V5 Example - List Child Pages from Current Page
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@* Check we have child pages *@
@if (DynamicModel.Children.Any())
{
<nav id="subnavi">
<ul>
@inherits PartialViewMacroPage
@using Umbraco.Cms.Web
@using Umbraco.Cms.Web.Macros
@using Umbraco.Framework
@{
@* Get the macro parameter and check it has a value otherwise set to empty hive Id *@
var startNodeID = String.IsNullOrEmpty(Model.MacroParameters.startNodeID) ? HiveId.Empty.ToString() : Model.MacroParameters.startNodeID;
}