So I have been researching this issue and I can see that I'm facing a lot of issues at the same time.
Basically... I want to create a site template that has publishing features enabled and then it also has multiple subsites and those subsites might have a couple of subsites as well. Many of the pages in the template have different page layouts as well.
All of the subsites will inherit the same master page from the root level of the site collection.
The main problem is that creating a site template of a site with publishing features is not supported. If I append the _layouts/savetmpl.aspx to create a template anyway, I don't get the subsites and the created site is broken in multiple ways. Home page hasn't been set up, it doesn't inherit the correct master page, etc.
At the moment I am trying to figure out the best way to accomplish this and I was thinking of doing something like this:
- Create all of the pages&subsites in the the site I want to use as a template and rename it as "Site A Template" (for example)
- Create an empty site collection template
- Add a new event receiver that gets fired when the new template is used to create a site
- Programmatically enable all of the publishing features and other necessities inside the new site
- Copy all of the content from the "Site A Template" to the created site including the subsites and the content inside those subsites (using a recursive loop)
Can anyone tell me if I'm on the right track? Maybe I'm overthinking this and there's a better solution that I'm not seeing..