Enabling publishing infrastructure feature by default in sharepoint 2010? - sharepoint

I know how to in the settings activate publishing feature on a site but is it possible to have this by default when a new site is created from the UI?
I have some customized stylesheets and when a new team site is created it doesn't load these but instead looks like a sharepoint site out of the box. When I go to settings and activate publishing features the page reloads with the custom stylesheets. I wish to not have to do this every time a new site is created. Is there a solution to this?
Thanks in advance.

I guess you could either:
Build a site template (can't remember if these store feature activations)
Build a custom site definition, and activate the features you need
Build a stapling feature to tie your feature to the site definition

Related

SharePoint 365 - Site Templates

I've recently create a site template on our SharePoint online environment which did originally have site publishing features enabled. This was done by setting the appropriate flag to enable saving as a template and then using the url /_layouts/15/savetmpl.aspx to save it.
When creating a site from this template i get intermittent errors indicating something went wrong but with no further detail other than a correlation ID. It's not every time and it happens occasionally when using the site.
A couple of questions on this.
a) What with the publishing infrastructure is not supported within Site Templates.
b) What is the best approach to create a custom site template where i can have a custom front page containing web parts and content, based on the publishing page layouts. I've searched through a significant number of posts online and cannot find a definitive answer to this.
Any help is much appreciate. Thanks in advance.
Grant
Please follow the below steps to create Site using custom template :
1.Firstly create site using custom template and select "upload site template later" or "upload solution later".
2.Then go to your created site and firstly enable publishing feature before uploading your site template to the solution gallery.
3.After that just go to the "Solutions" under "Web Designer Galleries" and upload your "Site template".
4.Now go to Site settings and select "Sites and workspaces" under "Site Administration".
5.And you can create your Custom site. you can see your uploaded Site template in Custom tab
Feel free to ask question if you have any doubt.

How to force users to use specific custom template for meeting workspaces?

I have a calendar on a SharePoint 2010 site and I have created a custom site template based on the standard meeting workspace. I'd like to force users to only be able to use my custom template.
One option is to add Hidden="TRUE" in webtemp.xml for all other meeting workspace templates - this will leave mine as the only option. This, however, works on the farm level and I'd like to keep the templates available for other web applications. If I can do this on a web application or lower level it will do the trick.
Even better solution - if I can make the new event dialogue skip the step altogether and use my template without asking.
Background:
My custom template only contains security customizations, no UI or content changes. I want to impose it as I have requirements for the permissions of the meeting workspaces which are different from the parent site - so inheritance has to be broken. But I can't think of another way to supply default permissions other than by using a site template for the workspace.
Site Settings > Look and Feel > Page Layouts and Site Templates
choose the site templates you want to be used in the site, this can inherit all the way down the site collection or you can start in a subweb.

Site Template and Master pages

I am a .net developer and want to learn SharePoint. Usualy we use MasterPages to have a constant layout for all or some of the pages. My confusion here is SharePoint uses Site Template and MasterPages which both sounds to do same thing. am I right?
thanks
MasterPages and Site templates are absolutelly different thing. Master page is usually layout of some pages. It's same like in ASP.NET.
In Sharepoint you can create some sites in site collection. These sites are created according to site template. When you creating (for example) team site, it's created according to team site template, which is stored in Sharepoint folder on file system. In site templates you can specify which features should be activated when site is created, which features should be activated on site collection scope etc. Also you can specify list, which should be created, modules... And also you can specify default master page which will be used on site.
You can find more informations on msdn

Sharepoint Site Template - Activate dependent features on provisioning

I wish to define a Sharepoint site template that will also include a web part dependent feature. How can I install and activate the web part feature when I provision a site using my custom template?
You can't install a feature when provisioning a site you can only activate it
If your developing a Site Template then you can activate the feature by activating it inside the site you use to create your site template before you save it as a template.
But if this is something that's going to be reused I recommend that you develop a Site Definition instead and in here you can specify which feature to activate both at Site Collection and Site level. You can then package your feature and site definition into the same Solution package then the feature will always be installed when referenced by the Site definition

Creating Site Templates from MOSS publishing sites

I know that creating a site template from a MOSS publishing site is not currently supported by Microsoft.
Can anyone tell me if creating a basic site, then turning on the publishing feature, then creating a site template is supported - I would guess not as it's probably the same as creating a publishing portal?
You can staple the publishing feature onto your site template.
From KB 986908:
You can create a stapling feature to staple the Office SharePoint Server Publishing feature to specific site templates. For example, see the Feature.xml file in the "Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Features\PublishingStapling" folder. To staple the Office SharePoint Server Publishing feature to all site templates, use the TemplateName="GLOBAL" property. This property staples a particular feature to a site definition if the site definition does not specify the AllowGlobalFeatureAssociations property. (Only the Shared Services Provider site template and the Blank Site site template use the AllowGlobalFeatureAssociations="FALSE" property.)
For example, when you use the TemplateName="GLOBAL" property to staple the Office SharePoint Server Publishing feature, a site that is based on the Team site template uses the system master page that is configured for the root site of the site collection.
you can still access the save template webpage, and save it...
for example http://localhost/website/_layouts/savetmpl.aspx
and it works like a charm :-)
I don't think what you're describing will work (like you said, it's basically the same thing as a Publishing Portal), but there appears to be a workaround. According to this post from the SharePoint Solutions Team (apparently not related to Microsoft), you can create a publishing site, customize it as needed, deactivate the publishing feature, create a site template from it, create a new site based on the template, and then activate the publishing feature on your new site.
It sounds like this works, but is not officially supported by Microsoft. Be careful, since it may mostly work, but I wouldn't be surprised if some small pieces of it break.
We wrote our own tooling to solve the export problem. We can create site columns, content types, master pages, page layouts etc in the Publishing site, and export selected items to a WSP package for deployment to other servers.
The tool SPSource takes a similar approach, but creates a Visual Studio solution for compilation. The result can be packaged with WSPBuilder.

Resources