Blog Discussion: Xperience by Kentico Refresh - March 21, 2024

Kentico Community
2024/03/21 7:16 PM

Blog Post: Xperience by Kentico Refresh - March 21, 2024

Continue discussions 🤗 on this blog post below.

Answers

2024/03/21 7:25 PM

Personally, I'm really looking forward to updating the Community Portal to use taxonomies.

We have content item relationships for Blog posts that are a stand-in for taxonomy, but Q&A doesn't use any taxonomies at the moment. That's why we see "Answer Question" and "Submit your answer" buttons when engaging in comments for a blog post here.

There's a little bit of string comparison on Q&A question titles to improve the UX, but obviously not enough.

Taxonomies will make these UX improvements easy and scalable.

They will also simplify the BlogPostList widget used on the home page.

2024/03/22 10:36 PM

Love this refresh! ♥

The new content query API enhancements will be super useful - there have been a few occasions recently where I have been writing a query for a component that doesn't know the exact content type.

I have had to write so many workarounds in content query's when I've not known the exact content type. Another example is making a sitemap.xml for my blog site - I wanted to retrieve all pages on my site to output the general information in the sitemap, but there was no way of doing this. Hopefully I will be able to significantly improve my code here 🙏

I have just been playing with the Taxonomies and Tags, it looks like a great first release! One thing I can see myself needing, is modifying the taxonomies/tags further - I'm thinking being able to add extra fields to tags. In the past, clients might have wanted to associate a Tag with a specific colour, or image, or some other metadata that you'd ideally store against the Tag.

2024/03/23 5:55 PM

Great update, much needed.

That said, has anyone gotten the IContentQueryExecutor.GetMappedWebPageResult<> stuff to work? After regenerating the Kentico autogen page type models, which have the new [RegisterContentTypeMapping] attribute, Kentico complains that it cannot find a type registered to the code name of queried pages.

Of these, only the explicit mapping works, and Dancing Goat doesn't have an example of GetMappedWebPageResult<>(), so I'm wondering if there's some undocumented setup requirement or something else I've missed?

ContentItemQueryBuilder builder = new ContentItemQueryBuilder()
	.ForContentTypes( config =>
	{
		config.OfContentType( PageContentTypes.Card.CONTENT_TYPE_NAME );
		config.WithContentTypeFields();
	} );

var mapped = await queryExecutor.GetWebPageResult( builder, kenticoMapper.Map<T>, cancellationToken: cancellationToken );
//Doesn't work: var mapped = await queryExecutor.GetMappedWebPageResult<PageContentTypes.Card>( builder, cancellationToken: cancellationToken );
//Doesn't work: var mapped = await queryExecutor.GetMappedWebPageResult<IWebPageContentQueryDataContainer>( builder, cancellationToken: cancellationToken );
//Doesn't work: var mapped = await queryExecutor.GetMappedWebPageResult<IContentItemFieldsSource>( builder, cancellationToken: cancellationToken );

Error: ArgumentException: Type for content type name 'Xxxx.Card' is not found. CMS.ContentEngine.ContentTypeMappingRegister.Get(string contentTypeName) CMS.ContentEngine.ContentQueryModelTypeMapper.CMS.ContentEngine.IContentQueryModelTypeMapper.Map<TModel>(IContentQueryDataContainer dataContainer) CMS.ContentEngine.ContentQueryExecutor.Map<TModel>(IContentQueryDataContainer dataContainer) CMS.Websites.ContentQueryExecutorExtensions+<>c__DisplayClass3_0<TModel>.<GetMappedWebPageResult>g__ResultSelector|0(IWebPageContentQueryDataContainer dataContainer) CMS.Websites.ContentQueryExecutorExtensions+<>c__DisplayClass0_0<TModel>.<GetWebPageResult>b__0(IContentQueryDataContainer contentQueryDataContainer) CMS.ContentEngine.ContentQueryExecutor.GetResultInternal<TModel>(ContentItemQueryBuilder builder, Func<IContentQueryDataContainer, TModel> resultSelector, ContentQueryExecutionOptions options, CancellationToken cancellationToken) Xxxx.Kentico.Infrastructure.Services.ContentService.GetFromContainer<T>(Guid containerGuid, IRequestContext context, CancellationToken cancellationToken) in ContentService.cs + var mapped = await queryExecutor.GetMappedWebPageResult<IContentItemFieldsSource>( builder, cancellationToken: cancellationToken );

2024/03/25 5:48 PM

@buddwright

Hey! Glad you've adopted the new APIs.

Make sure you're doing a full build to use the re-generated content types C# classes.

Also, make sure you have the "AssemblyDiscoverable" attribute somewhere in the project containing your generated content type classes.

My preferred approach is to use an attribute in the .csproj, because this attribute tells Xperience to pay attention to the assembly/project when looking for types and configuration.

  <ItemGroup>
    <AssemblyAttribute Include="CMS.AssemblyDiscoverableAttribute">
    </AssemblyAttribute>
  </ItemGroup>

But you can also include the attribute in any compilable C# file in the project.

using CMS;

[assembly: AssemblyDiscoverable]
2024/03/25 5:55 PM

@liamgold

I have just been playing with the Taxonomies and Tags, it looks like a great first release! One thing I can see myself needing, is modifying the taxonomies/tags further - I'm thinking being able to add extra fields to tags. In the past, clients might have wanted to associate a Tag with a specific colour, or image, or some other metadata that you'd ideally store against the Tag.

Yes, taxonomies in Xperience by Kentico are a lot closer to "content" than Categories or Tags in Kentico Xperience 13, but they aren't pure content, like a custom content type model is.

To keep taxonomies fast (and highly cacheable), we don't support versioning or workflow with them. Which means you aren't penalized with the complexity of the Content hub data if you don't need it. I think if you need to treat taxonomies as content, then model that content as a content type and connect the content type back to the taxonomy with its own Tags field.

There is a TaxonomyMetadata column in the CMS_Taxonomy table which is used for localization of the taxonomy Title/Description, but it's definitely an implementation detail and not meant to be customized (yet!)

To answer this question, you have to login first.