Attempting to associate templates with pages from migration
I am attempting to associate pages that I migrated over from an older instance with new page templates that were created for items of that type, but I am getting this error:
InvalidOperationException: The web page (WebPageItemID: '7096', Content type: Convenience.Page) is requested to be rendered via a page template (called 'TemplateResult' in a MVC controller). However, the web page does not have a page template assigned. Re-create the page and select a page template during the web page creation process.
Is there a way to assign a template to these pages without having to re-create them or else what is the point of migrating them over? There are literally thousands of pages and so re-creating them all isn't really an option. I've been trying to see if there is somewhere in the database that it assigns a template value but have not been able to successfully locate it.
Any help would be most appreciated.
Environment
- Xperience by Kentico version: [30.0.0]
- .NET version: [8]
- Execution environment: [SaaS, but localhost]
Answers
Check out Diagnosing Xperience by Kentico Page Template issues.
My recommendation would be to use a SQL migration in CI and CD to update all web pages that need to use a Page Template now but were created before there were any registered.
- Create a new page and select the Page Template you've registered.
- Query for the page template configuration\
SELECT WP.WebPageItemTreePath, CD.ContentItemCommonDataVisualBuilderTemplateConfiguration FROM CMS_ContentItemCommonData AS CD INNER JOIN CMS_WebPageItem AS WP ON CD.ContentItemCommonDataContentItemID = WP.WebPageItemContentItemID
- Write a migration query to update the pages that need to use the same configuration
To answer this question, you have to login first.