Skip to content

Latest commit

 

History

History
85 lines (72 loc) · 17.9 KB

File metadata and controls

85 lines (72 loc) · 17.9 KB

Samples submitted to date

  • andyboot

    • Seamlessly Allow Segmentation by Extending uSync Imports - This code was created to automatically enable segmentation support on content types and their properties during uSync imports in Umbraco. Normally, you’d have to manually update countless document types, compositions, and properties to enable segmentation so they can be used with features like Umbraco Engage. By hooking into the uSyncImportingItemNotification, the handler ensures that whenever a content type is imported, its variation settings are corrected: Nothing becomes Segment, and Culture becomes CultureAndSegment, leaving other values untouched. This removes a repetitive manual task, ensures consistency across environments, and gives teams confidence that segmentation is always applied correctly during synchronisation.
    • Strongly Typed Base Views for Umbraco Block List Items - By default, Umbraco asks you to inherit UmbracoViewPage in every block partial, which leaves you pulling Content and Settings out of Model as plain IPublishedElement and manually casting them to your Models Builder types—repetitive, messy, and error-prone. To fix that, you can treat block list items as first-class views with two simple base classes: @inherits UmbracoBlockListItemView<MyContentBlock, MySettingsBlock> when you’ve got both content and settings, or @inherits UmbracoBlockListItemView when it’s just content. With these, your partials stay clean and easy to read, because you can call @Model.Content and @Model.Settings directly as strongly typed objects, with content throwing a clear error if the wrong type sneaks in and settings handled safely as optional. This makes block views feel purpose-built, removes boilerplate casting, and keeps your Razor files focused on rendering rather than plumbing.
    • Deep Dive Into Umbraco String Extension Methods - This post takes a closer look at the string extension methods provided by Umbraco, originally written for version 11. It walks through a wide range of helpers—covering everything from sanitising input, stripping HTML, and truncating text, to detecting JSON, generating safe URL segments, and working with file extensions. While the article was written with Umbraco 11 in mind, most of these methods (or their equivalents) remain just as useful in later versions, making it a handy reference for anyone working with text in Umbraco today.
    • Umbraco Forms - Add additional attributes to existing field types - This blog walks through how to extend existing Umbraco Forms field types by adding new custom attributes. For example, the author shows how you can inherit from the default Textfield, add a “Span all columns?” setting, and then use that in the form view to control layout (e.g. span across two columns via CSS). It’s a great guide if you ever need to tweak or customise the built-in form fields beyond their default options.
    • Debug HTTP Requests within Visual Studio - This gist shows how to set up and debug HTTP requests (e.g. APIs) directly inside Visual Studio, making it easier to test endpoints without switching to external tools. It includes sample api.http scripts (for things like POSTing JSON payloads) and guidance on configuring your debugging environment. A handy reference if you frequently work with backend APIs and want streamlined in-IDE testing capabilities.
    • How to Upgrade from Umbraco 8 to 13 LTS - A walkthough the full migration journey—from a legacy .NET Framework setup in Umbraco 8 to a modern .NET 8 + Umbraco 13 architecture. It outlines why lingering on Umbraco 8 is risky (no security patches, falling behind on features), and then maps the upgrade path: first migrating to Umbraco 10, then onward to 13. Along the way it highlights key changes (e.g. switching from System.Web to ASP.NET Core, moving from Surface Controllers to View Components, adopting DI patterns, reworking old editor data with uSync migrations, etc.). The author also shares practical tips—like using Git worktrees to manage multiple codebases, and handling Umbraco Forms version jumps—to ease the process.
  • glombek

    • Modifying the ExternalIndex - This sample demonstrates how to modify the default ExternalIndex Examine index.
    • Exact-matching multiple strings when searching with Examine - Searching for exact strings in Examine can be a little counter-intuitive. Couple that with the confusion of multiple values (potentially using the Repeatable text strings or tag data types) and inconsistencies between the backoffice tooling and the fluent API and you've got a right potential mess on your hands!
    • Umbraco AngularJS filter cheat sheet - In Umbraco v13 and below, the Block editors (list and grid), Nested Content and custom list views allow you to customise how the summarized/collapsed items appear using AngularJS templates and filters - you're not just stuck with the default!
    • Migrating Rich Text Editor Macros to Blocks using uSync Migrations - Modern Umbraco allows Blocks to be added inline in the Rich Text Editor. Umbraco 14 removes support for macros. This code sample will map macros to blocks with the help of uSync Migrations.
  • jawood1

    • Umbraco Mock Helper for Unit Testing - A helper class for creating mocked Umbraco objects for unit testing. Includes methods for mocking IPublishedContent, IPublishedElement, BlockList/BlockGrid items, MediaWithCrops, UmbracoHelper, and URL providers using Moq.
    • Umbraco Controller Testing Base Class - Base class for testing Umbraco-based controllers with ASP.NET Core. Provides a method to create mocked IFeatureCollection with UmbracoRouteValues, allowing access to CurrentPage in controller tests. Includes proper setup for HTTP request/response features.
  • jbreuer

  • jemayn

  • kjac

  • liamgold

  • liamlaverty

  • luuk1983

  • mbreas

    • Umbraco Remote Filesystem implementation example - Umbraco Remote Filesystem example implementation is a ready-to-run Umbraco solution demonstrating how to integrate external filesystem that allowes you to store your Umbraco media remotely. Ideal for loadbalanced websites
  • owainjones

  • paulsterling

    • Extend Umbraco Forms with Custom Workflows - In this example we create a custom workflow that detects and redirects form submissions containing nonsense or gibberish using a specialized classifier, and then apply a second workflow to check for disposable email addresses. Extending workflows can add significant value to Umbraco Forms by integrating custom business logic, enhancing validation, and allowing more tailored responses to form submissions.
  • rickbutterfield