I am currently working on converting my WebForms site to MVC in Umbraco v7.6.2. I have been able to re-create the WebForms templates as separate MVC templates and that has worked well for individual pages. Without touching each individual page, is there a way to update all pages to use a new default template?
Here is what I have tried:
Set the default template for the Document Types to the new MVC template
Delete the old WebForms templates from the Document Types
Republish entire site
This made the template field for the Content document blank.
Thanks for the response, but that is not quite what I am looking for, and I apologize ahead for the longer post.
I currently have templates (site wide master and homepage/sub page) that were created when the site was set to WebForms (umbracoSettings.config <defaultRenderingEngine>WebForms</defaultRenderingEngine>). All of our documents are currently using those templates. I want to upgrade our site to Umbraco v7.6.2 and change the templates to be MVC templates (Layout/partial views).
I was able to re-create the current WebForms templates using MVC in the Templates section of the settings area and I now want to use the new MVC templates instead of the old WebForms templates. To do this, it looks like I need to open each page, click on the Properties tab, go down and change the template to the new template.
What I am wondering is if there is an automated way to change all the pages using a certain template to use a different template?
I tried what I mentioned in the first post as well as the following:
Go into the database for Umbraco
Open cmsContentXml and filter for a specific page
Update the xml field by changing where it says template="1115" to the id of my new template (ex: template="2946"). This id can be found in cmsTemplate
Update the cmsPreviewXml for the current version (found in cmsContentVersion for the ContentID/nodeid of the page updated in step 3)
However, nothing changes and if you go into the Properties tab it shows a blank for the template and I still have to select the new MVC one from the drop down and click the Save and Publish button.
I noticed that the logs show that the content xml is written to a file, but the logs don't mention where that file is.
One of my sites has a few hundred pages and it would take a long time to update each page individually to use the new template.
Might be worth taking a look at Richard's plugin, it isn't free but it works and he's very responsive if you run into any issues: https://soetemansoftware.nl/bulkmanager
You could also do it programmatically using the content service API.
I'm a little late in this topic :) but still I'm mentioning this since it could be useful - I've put together some code that you can put on your app_code folder and on next application startup it will look for documents that don't have a template and update them with their default template (provided a default template has been defined for their doctype). It's an one-time thing, so then you can remove it.
It works only if documents don't have any template, which I fear is not your case, but I'm mentioning it here in case somebody else has a similar issue. It's saved me from having to manually update dozens of nodes a couple of times.
Thanks Sortiris. I ended up making my own custom plugin that let's me select one template and change all documents that use that template to another template that I select. If anyone is interested I can post the code here.
Apply new site wide default template
Hi all,
I am currently working on converting my WebForms site to MVC in Umbraco v7.6.2. I have been able to re-create the WebForms templates as separate MVC templates and that has worked well for individual pages. Without touching each individual page, is there a way to update all pages to use a new default template?
Here is what I have tried:
This made the template field for the Content document blank.
I'm not sure if this helps.
https://our.umbraco.org/documentation/tutorials/creating-basic-site/creating-master-template-part-1
I dont know what the difference is but we use a sitewide master template and a homepage template.
Thanks for the response, but that is not quite what I am looking for, and I apologize ahead for the longer post.
I currently have templates (site wide master and homepage/sub page) that were created when the site was set to WebForms (umbracoSettings.config
<defaultRenderingEngine>WebForms</defaultRenderingEngine>
). All of our documents are currently using those templates. I want to upgrade our site to Umbraco v7.6.2 and change the templates to be MVC templates (Layout/partial views).I was able to re-create the current WebForms templates using MVC in the Templates section of the settings area and I now want to use the new MVC templates instead of the old WebForms templates. To do this, it looks like I need to open each page, click on the Properties tab, go down and change the template to the new template.
What I am wondering is if there is an automated way to change all the pages using a certain template to use a different template?
I tried what I mentioned in the first post as well as the following:
However, nothing changes and if you go into the Properties tab it shows a blank for the template and I still have to select the new MVC one from the drop down and click the Save and Publish button.
I noticed that the logs show that the content xml is written to a file, but the logs don't mention where that file is.
One of my sites has a few hundred pages and it would take a long time to update each page individually to use the new template.
Might be worth taking a look at Richard's plugin, it isn't free but it works and he's very responsive if you run into any issues: https://soetemansoftware.nl/bulkmanager
You could also do it programmatically using the content service API.
-Amir
Thanks Amir! I will check out both of those options.
I'm a little late in this topic :) but still I'm mentioning this since it could be useful - I've put together some code that you can put on your app_code folder and on next application startup it will look for documents that don't have a template and update them with their default template (provided a default template has been defined for their doctype). It's an one-time thing, so then you can remove it.
It works only if documents don't have any template, which I fear is not your case, but I'm mentioning it here in case somebody else has a similar issue. It's saved me from having to manually update dozens of nodes a couple of times.
Here's the post with the code: http://www.dot-see.com/en/blog/bulk-updating-document-types-with-their-default-templates/
Thanks Sortiris. I ended up making my own custom plugin that let's me select one template and change all documents that use that template to another template that I select. If anyone is interested I can post the code here.
is working on a reply...