Basics facts of Publishing Sites
Wish you All A Very Happy New Year 2009!!!
I am working on a MOSS publishing site and thought of sharing some of the basic things that we should always remember while implementing a Publishing site on MOSS / Sharepoint 2007:
1. There can only be one and only one PAGES library in any sharepoint publishing site (we can create a document library and treat it as Pages library but I don’t know if this is supported as the publishing document library (PAGES) has several features like approval workflow, etc attached to it on creation)
2. Sub-folders are not supported in PAGES library (https://support.microsoft.com/kb/948614/en-us)
3. Always remember Web parts(WP) doesn’t save any data and they are not stored with the Pages, WPs are only referenced in the Pages. Andrew Connell has an excellent blog on Field Controls and Web Parts here: https://www.andrewconnell.com/blog/archive/2008/10/09/Publishing-sites-field-controls-or-Web-Parts.-that-is-the.aspx
4. You can't save the publishing site templates using the SAVE AS SITE TEMPLATE, even with the hacks that are floating around as this is not supported.
5. Beaware of those links referenced in the Content Editor Webparts they dont transfer nicely from environments to envrionments when you do a Content deployment from lets say integration to Staging or from Staging to Production envrionment. But hold there is a solution to this problem and Maxime Bombardier explains it in details here: https://blogs.msdn.com/maximeb/archive/2008/12/23/fixing-absolute-urls-for-all-alternate-access-mappings-aam-of-content-editor-web-part-with-a-control-adapter.aspx
6. If you want to programmatically check if the Content Page is Published, the best way to achieve this is by using the PublishingPage.ListItem.File.Level (https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfilelevel.aspx) i.e. check out the following classes and its members PublishingPage, SPListItem, SPFile and finally the SPFileLevel enumerator. Thanks to Mak for point this out.
7. Programmatically find out all the Page Layouts currently used by any or all content pages in the site collection:
StringCollection strPLCollection = new StringCollection();
using (SPSite site = new SPSite("https://litwareinc"))
{
foreach (SPWeb web in site.AllWebs)
{
if (PublishingWeb.IsPublishingWeb(web))
{
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
try
{
foreach (PublishingPage contentPage in publishingWeb.GetPublishingPages())
{
string strPLURL = contentPage.Layout.ServerRelativeUrl;
// This will ensure we don’t add the same Page Layout URL
if (!strPLCollection.Contains(strPLURL))
{
//Adding to the string collection
strPLCollection.Add(strPLURL);
}
}
}
catch (Exception ex)
{
//write your exception handling message here:
}
}
web.Dispose();
}
}
foreach (string strPL in strPLCollection)
{
Console.WriteLine(strPL);
}
8. If you want to move your Master Pages, Page Layouts, etc (almost all of the branding stuff) then use Sharepoint Features/Solutions, and Andrew Connell has explained it in details: https://www.andrewconnell.com/blog/archive/2006/12/20/5451.aspx
9. If you want to keep a webpart always intact on any content page, then open the Page Layout with SharePoint Designer and move the web part outside of the web part zone so the web part is hosted directly by the (Page Layout) aspx. This will not allow the contributors/Authors to move, add or delete any web parts.
Comments
- Anonymous
January 04, 2009
PingBack from http://www.codedstyle.com/basics-facts-of-publishing-sites/