Paul Sea and Tim Payne did a talk at Umbraco Spark a while back when Umbraco moved from V7 to V8 and from XML Published Cache to NuCache BTree implementations, and this is the point in time when using XPath became slower than NuCache, because the published cache was no longer stored as XML.
and still a good resource to flip through to understand the change, they benchmarked lots of different approaches and showed that DescendentsOfType was particular quick! or at least reversing the previous knowledge of use XPath for this kind of thing..
All depends on the context and size of your site and what you are trying to do, query wise, but now using NuCache direct using Descendents/Children etc is quicker than XPath, because in order ot generate the XML for XPath to be actioned, the NuCache needs to be queried first anyway!
There is a good cheat sheet here of the updated syntax for the dot net core versions of Umbraco, if that helps as a reference.
Any idea what would be the replacement for Umbraco:CMS:Content:Error404Collection:ContentXPath in appsettings.json, where hard coding a GUID is not an option?
The official docs still recommend Xpath for cloud environments;
If you are hosting your site on Umbraco Cloud, the best approach would be using an XPath statement. This is because content IDs might differ across Cloud environments.
For that instance, I think you are still going to be using XPath, in Umbraco 14 XPath will be removed and a new 'dynamic' start node functionality is going to be introduced to do all those relative Xpath type things that still linger on.
that I then work out which site is being requested from the domain of the url that is 'about to 404', then find the page not found doc type within that site and return that...
There is a package that has a UI for setting a page not found page in a multisite setup that has an implementation of LastChanceContentFinder that might be worth a look.
Get content by type (without ContentAtXPath).
With the obsoletion of ContentAtXPath and ContentSingleAtXPath, does anyone know the most performant way to get content by type?
Looping through the entire site and checking the type of each one in turn seems less than performant.
Hi Neil
Paul Sea and Tim Payne did a talk at Umbraco Spark a while back when Umbraco moved from V7 to V8 and from XML Published Cache to NuCache BTree implementations, and this is the point in time when using XPath became slower than NuCache, because the published cache was no longer stored as XML.
The slides are here:
https://umbracospark.com/media/p0xgaq2u/querying-umbraco.pptx
and still a good resource to flip through to understand the change, they benchmarked lots of different approaches and showed that DescendentsOfType was particular quick! or at least reversing the previous knowledge of use XPath for this kind of thing..
All depends on the context and size of your site and what you are trying to do, query wise, but now using NuCache direct using Descendents/Children etc is quicker than XPath, because in order ot generate the XML for XPath to be actioned, the NuCache needs to be queried first anyway!
There is a good cheat sheet here of the updated syntax for the dot net core versions of Umbraco, if that helps as a reference.
https://docs.umbraco.com/umbraco-cms/fundamentals/design/templates/razor-cheatsheet
regards
Marc
https://github.com/umbraco/Announcements/issues/10 I would read through the comments on that announcement if you haven't already.
Thanks for that Marc.
Any idea what would be the replacement for Umbraco:CMS:Content:Error404Collection:ContentXPath in appsettings.json, where hard coding a GUID is not an option?
The official docs still recommend Xpath for cloud environments;
https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/tutorials/custom-error-page
Hi Neil
For that instance, I think you are still going to be using XPath, in Umbraco 14 XPath will be removed and a new 'dynamic' start node functionality is going to be introduced to do all those relative Xpath type things that still linger on.
https://github.com/umbraco/Announcements/issues/10#issuecomment-1761671191
For 404's I've not used that setting for a long time, instead I've been using a LastChanceContentFinder:
https://docs.umbraco.com/umbraco-cms/implementation/custom-routing#last-chance-icontentfinder
that I then work out which site is being requested from the domain of the url that is 'about to 404', then find the page not found doc type within that site and return that...
There is a package that has a UI for setting a page not found page in a multisite setup that has an implementation of LastChanceContentFinder that might be worth a look.
https://marketplace.umbraco.com/package/hotchilli.umbraco.pagenotfound
regards
Marc
Cheers Marc, most helpful 👍
is working on a reply...