Skip to content

Instantly share code, notes, and snippets.

View hfloyd's full-sized avatar

Heather Floyd hfloyd

View GitHub Profile
@hfloyd
hfloyd / Error404Page.cs
Created May 3, 2024 15:04
Umbraco v13+ 404 Error IContentLastChanceFinder - Supporting multiple sites at root
namespace MYSITE.Web;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Web;
using Umbraco.Extensions;
@hfloyd
hfloyd / PageTypesDataSource.cs
Last active May 20, 2021 21:15
Contentment Custom IDataListSource: Umbraco Page Types
namespace YourCode
{
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
@hfloyd
hfloyd / CG18Demo_Results.cshtml
Last active April 28, 2021 19:30
Umbraco 7: Example Code for 'Displaying Results After an Umbraco Form Submission'
@inherits UmbracoViewPage
@{
var sFormGuid = "26fcda6d-6a2f-46be-a164-a5dbb235fcd8"; //CG Demo form GUID
var formData = new Dragonfly.Forms.Models.FormWithRecords(sFormGuid); //Using FormWithRecords() Model
var surveyModel = new FormCgDemo(sFormGuid); //Using Custom data model (defined in an external file)
}
@hfloyd
hfloyd / AuthorizedApiController.cs
Created April 16, 2020 02:10
A WebAPI Controller for use in an Umbraco 8 Website in the event that you need to re-save/re-publish all Content nodes
namespace MyProject.Core.WebApi
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using Dragonfly.NetModels;
using Newtonsoft.Json;
using Umbraco.Core.Models;