ITitleAspect and {Content.Slug} = empty permalink

Topics: Writing modules
Aug 8, 2012 at 1:06 PM

Hi,

I'm implementing ITitleAspect interface on a ContentPart, and when I set the AutoRoute pattern to {Content:Slug}, I'm returned an empty slug on part create.

I think AutoRoute may require a TitlePart on the ContentType, how does this work?

Thanks in advance.

Aug 8, 2012 at 1:17 PM

Further to this, I've just checked the database, and UseCustomPattern is set to bit 0 for the ContentTypes I'm having problems with, but it is enabled in the admin for the ContentType.. not sure what's going on here..

Heres from my migrations.cs:

ContentDefinitionManager.AlterTypeDefinition("MusicCatalog",
               cfg => cfg
                   //.WithPart("TitlePart")
                   .WithPart("AutoroutePart", builder => builder
                       .WithSetting("AutorouteSettings.AllowCustomPattern", "true")
                       .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false")
                       .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'umweb-musiccatalogs'}]")
                       .WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
                   .WithPart("CommonPart")
                   .WithPart("MenuPart")
                   .WithPart("MusicCatalogPart")
                   .WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "5"))
                   .DisplayedAs("Music Catalog")
                   .Creatable()
                   .Indexed()
               );



Coordinator
Aug 9, 2012 at 6:12 AM

You only need a title part if the autoroute pattern is using title or slug tokens.