Content References in XhtmlString Properties

XHtmlString properties are more than just HTML, they include HTML, internal links to content, embedded blocks, personalization, and more. Blend's Director of Development Bob Davidson takes a brief look at the internals of XhtmlString properties and the fragments that make them.

2/2/2022

Authored by

Categorized

  • Development
  • Optimizely

 

A string of fragments.

Strictly speaking, an XhtmlString property is, in fact, a string at heart. But it’s a string made up of special segments that must be interpreted. These segments are more accurately known as Fragments, each of which are instances of IStringFragment. These fragments represent a number of things an editor can embed within an XhtmlString:

Static HTML/Text - Plain old text is represented in StaticFragments. These fragments are not necessarily complete HTML, but rather substrings of HTML. A static fragment might stop at the start of a href attribute value, if the link in that href is a permanent link. These fragments, for the most part, require no special processing.

  • Links to content - Links to content within the CMS are UrlFragments. These fragments have a URL property that represents the Permanent Link of the linked content. If you’ve ever seen links rendered on the front end that start with /link/ and contain an embedded GUID, those are likely permanent links that are not being resolved correctly.
  • Embedded content - Editors can drag blocks and page partials into the XhtmlProperty editor. These blocks are represented as ContentFragment instances. The fragment will give you the Content GUID, Content Link, Display Option, and more.
  • Personalized content - Editors can personalize blocks in the XhtmlString property in the same way they do in content areas. These personalized sections are represented as PersonalizedContentFragments. From these fragments, you can get a list of roles (visitor groups) this section targets, and a collection of child fragments representing the content to display to those roles.
  • And more! There’s a DynamicContentFragment if you’re still using dynamic content, for example.

The fragments here are really just scratching the surface of how XhmlStrings are rendered and indexed. And the same is true for Content Areas, which are actually specialized XhtmlStrings.

Blend's Director of Development, Bob Davidson, provides tutorials on all things development.

His web series, Coding with Bob, can be found on Youtube. Check it out!

Resources on .NET development.

We’ve written at length, both here and beyond, on .NET development.

Upgrading from Umbraco 7 to 11 — The Editor Experience

Chase Burandt

On September 30th, Umbraco will stop support on Umbraco 7. What does this mean for the overall editorial experience, and what can you expect as you begin upgrading?

January 25, 2023

Episode 15: Determine System Requirements (w/ Joe Kepley) Off-site link

Corey and Deane discuss the three parts of selecting a CMS: requirements, tool, and development team. Then, Joe Kepley, chief technical officer at Blend Interactive, joins us to discuss the world of translating design and IA into code within a content management system — including balancing groundbreaking design with realistic engineering — and the need to tie high-level project goals into the real nuts and bolts of code.

January 17, 2023 | The Web Project Guide Podcast

Episode 14: Know Your Integrations (w/ Greg Dunlap) Off-site link

Corey and Deane discuss the four major parts of a content model. Then, Greg Dunlap, Director of Strategy at Lullabot, joins us to define a web integration, discuss the finer details of development risks and runtime risks — as well as real-time vs scheduled data — and praise the efficiency of using Google Docs as a workflow tool. Corey and Greg give Deane a music lesson, too.

December 14, 2022 | The Web Project Guide Podcast

The Web Project Guide joins Content Strategy Insights podcast Off-site link

The Web Project Guide’s Corey Vilhauer and Deane Barker joined Larry Swanson on the Content Strategy Insights podcast to talk about all things The Web Project Guide — how the book came to be, how it ties to the work of building websites, and what's next as the book expands into the podcast space.

November 30, 2022 | The Web Project Guide

Check out our most recent articles on development.