Sharepoint Foundation master pages on subsites

空扰寡人 提交于 2019-12-23 13:15:44

问题


Using Sharepoint Foundation 2010 I've edited v4.master, added a ref to a new CSS file, saved the changes and they are applied to the home site no problem.

However when I create a subsite it uses the old version of v4.master for some irritating reason. I'm vaguely aware that some of the publishing features from SPS are not included in SPF so lots of the online advice isn't relevent (?)

If there is a way to make new subsites inherit the new V4.master I'd be very grateful.


回答1:


This is only possible with a custom WSP or an HttpModule, both requiring .NET code. The Server versions of SharePoint handle this easily with the Masterpage option, a quick google search for "foundation masterpage solution" gave good results, including:

http://blog.thedesigndrifter.com/?p=1112

http://rickhilferink.wordpress.com/2011/01/25/creating-a-sharepoint-2010-foundation-masterpage-solution-and-automatically-activate-it-for-all-sites-and-newly-created-subsites/




回答2:


If you'd like the ability to have a master page at the site collection root inherited by subsites, then you are best off using a publishing site template.

You can then go to: /_Layouts/ChangeSiteMasterPage.aspx and specify your custom master page, and have it inherited by all subsites.




回答3:


this is probably too late to benefit you, but maybe it will benefit others. I have found that if you do not rename the customized master page to something other than v4.master, then subsites will not inherit the customized version of v4.master but use the original uncustomized v4.master instead. So make sure that you make a copy of v4.master and rename it. Here are some steps from [my blog post], this is how i did it:

  1. Right-click on v4.master and select ‘Reset to site definition’ and the original v4.master will be restored, and SPD 2010 will automatically create a v4_copy(1).master page (screenshot 14).
  2. Check-in custom.master, publish a major version, and approve the file
  3. Go to Site Actions > Site Settings > Master Pages and select the new master page, custom.master, for both Site Master Page and System Master Page, and select the checkbox for ‘Reset all subsites to inherit this alternative CSS URL’ (screenshot 15)
  4. Now if you have forgotten to activate the publishing feature for you new subsite with the Team Site template, it will not inherit the custom.master page yet, so go to Site Actions > Site Settings > Manage site features and activate the publishing feature (screenshot 16)
  5. As soon as the feature is activated you should see the new master page and its styles (screenshot 17)



回答4:


I solved this problem by creating new a custom site defintion by Visual Studio and SharePoint Site Definition. I added a feature which adds my custom masterpage (edited from v4.master) into site collection's masterpage gallery (_catalogs/masterpage):

<Module Name="MasterPageModule" RootWebOnly="FALSE" List="116"  Url="_catalogs/masterpage" >
<File Url="mymasterpage.master" Path="MasterPageModule\mymasterpage.master" IgnoreIfAlreadyExists="TRUE" Type="GhostableInLibrary">
  <Property Name="ContentTypeId" Value="0x010105"/>
</File>  

The main thing to get the same masterpage for all sites is to set MasterPageFile -property in Default.aspx like this: MasterPageFile="~sitecollection/_catalogs/masterpage/mymasterpage.master" - this refers always to rootsitecollection level.

I think that same thing can be achieved by using FeatureActivated-method, but it didn't worked in my case, don't know why.



来源:https://stackoverflow.com/questions/4043526/sharepoint-foundation-master-pages-on-subsites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!