Kentico 12 MVC Saving pages as custom page templates not working

S T asked on November 6, 2024 10:50

Hi, I'm using kentico 12 MVC v12.0.101 and in the current project I'm working on, in the page properties tab I don't see the templates option. Going to the Page Templates (MVC)module there is just a pop-up hint saying "Not sure how to begin? The Page templates (MVC) application offers a list of all custom page templates available in your system. Do you want to create a new custom page template? Use the Pages application where you can save a page as a new template." so I've looked in the documentation here: https://docs.kentico.com/k12sp/managing-website-content/using-page-templates-in-mvc#saving-pages-as-custom-page-templates and dont see the three dots on the right side of the create a/b variant button. All of the page types are content-only page types and the root node page type has the option "Show template selection" checked but when adding new pages that step is skipped. Am I missing some configuration ? Regards

Recent Answers


Juraj Ondrus answered on November 7, 2024 06:49

Do you have actually any MVC page templates defined? I mean, are the pages using any of the MVC page templates so you can save them as a new ones?
The Properties -> Template section as well as the "Show template selection" are for portal engine model. These do not apply when using MVC.

0 votesVote for this answer Mark as a Correct answer

S T answered on November 7, 2024 10:37

I cant see in the code that the other pages are using templates except the one that im working on. I have made a template for this page using the steps in the docs here: https://docs.kentico.com/k12sp/developing-websites/page-builder-development/developing-page-templates-in-mvc From the main controller it goes to var node = tree.SelectNodes().WhereEquals("NodeAlias", nodeAlias).FirstOrDefault(); return new TemplateResult(node.DocumentID); but never reaches the template controller. In the event log i can see an error: "Message: Page template not found for selected page" But even if the template controller has the [assembly: RegisterPageTemplate("CompanyName.MyTemplate", typeof(MyTemplateController), "My template")] I cannot see it in the Page Templates(MVC) module nor does it appear when creating a new page.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 7, 2024 10:41

Is the page type configured well as well? Also, if the page template was developed AFTER the page was created, you need to delete the page and re-create it again from scratch.

0 votesVote for this answer Mark as a Correct answer

S T answered on November 7, 2024 10:48

I did re-create the page again, cleared cache and restarted the app but the same error appeared. As for the page type, I cant see "Show template selection" option in the general tab. The page type has the url pattern and use page builder checked and its a Content-only pages type. Am I missing something ?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 7, 2024 10:54

Show template selection is for PORTAL ENGINE only. It is OK that you do not see it for content only page type. I would recommend installing a fresh instance with the sample Dancing Goat MVC project and try it there. It seems you are missing some details in the process.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.