mauzilla
11/07/2023, 2:02 PMkdx-perbol
11/08/2023, 7:08 PMUmbracoContext.PublishedRequest.PublishedContent.GetProperty("title")
etc? This would get a property from the "current page" regardless of its document type.
We sometimes do this in our layout razors since they're just UmbracoViewPage
, not UmbracoViewPage<Something>
.kdx-perbol
11/08/2023, 7:12 PMtitle
property on the top-level document type and it would be inherited down. But I wholeheartedly recommend against using doctype and template inheritance, in favor of compositing.Sebastiaan
11/13/2023, 9:44 AMmaster.cshtml
at the point where you want your <title />
to be rendered, add: @await RenderSectionAsync("title")
.
This will force any template inheriting from the master to insert a title section which would look something like:
html
@section title {
<title>@Model.Title</title>
}
However, I think you just want to try this in your master template:
<title>@Model.Value("title")</title>
The "title"
here is the alias of your Title property. Do note, however that the Title property needs to be available on the document type for this template, so you might need to do a recursive scan and fall back to the parent title or a title even higher up. Depends a bit on your scenario.Sander L
11/15/2023, 9:41 AMkdx-perbol
11/15/2023, 10:02 AMITitle
, so it feels like a bit of a hack. But still preferable to actual document type inheritance.Sebastiaan
11/15/2023, 10:04 AM