Autoroute Path not being correctly generated when ContentItem is created via code. #10204
-
Hi, I have the following code in my project:
*simplified version of the code 👍 The AutoroutePart for this "Testimony" Content is defined like this: But when I create this content item via code, the permalink comes as "testimonials/-1" instead of "testimonials/Test". Can anyone help me with this? I have been looking at the AutoroutePart Module but I only got more confused XD. cc: @Skrypt OC Version : 1.0.0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to use DisplayText sets it's value from the TitlePart.Title from a handler and it seems that the value is not affected on the ContentItem yet when it gets parsed by this Liquid template. There is probably a small issue there but it should work by doing what I described above. |
Beta Was this translation helpful? Give feedback.
You need to use
contentItem.DisplayText = "Test"
else you could try to change your Liquid to use{{ ContentItem.Content.TitlePart.Title | slugify }}
DisplayText sets it's value from the TitlePart.Title from a handler and it seems that the value is not affected on the ContentItem yet when it gets parsed by this Liquid template. There is probably a small issue there but it should work by doing what I described above.