Skip to content

Instantly share code, notes, and snippets.

View ScottGuymer's full-sized avatar

Scott Guymer ScottGuymer

View GitHub Profile
@sleslie321
sleslie321 / rss.feed.cshtml
Created August 23, 2014 14:12
Create RSS Feed from Document Type in Umbraco using Razor
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{umbraco.library.ChangeContentType("text/xml");
var siteURL = "http://" + Request.Url.Host;
var HomePage = CurrentPage.AncestorOrSelf(1);
var RSSFeedPubDate = HomePage.Descendants("PressRelease").OrderBy("publishedDate desc").First();
}<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper">
@alindgren
alindgren / XMLSitemap.cshtml
Last active May 15, 2020 17:42
XML sitemap for Umbraco 7 (based on Cultiv Search Engine Sitemap package). See http://www.alexlindgren.com/archive/dynamically-generated-xml-sitemaps-with-umbraco-7/
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using System.Linq;
@{
Layout = null;
Response.ContentType = "text/xml";
}<?xml version='1.0' encoding='UTF-8' ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
@ListChildNodes(Umbraco.TypedContent(UmbracoContext.Current.PageId).AncestorOrSelf(1))