Setting up a new publishing site

SharePoint publishing capabilities are enabled with two SharePoint features, one at the site collection level and the other at the site level. With the site collection feature activated, the publishing site templates are made available to use when creating new sites in the site collection. These site templates automatically activate the required publishing feature at the site level. In this recipe, we will create a new publishing site in an existing site collection.

The SharePoint publishing site templates will only be available for use when the SharePoint Server Publishing Infrastructure site collection feature is activated.

Setting up a new publishing site

How to do it...

Follow these steps to set up a new publishing site:

  1. Navigate to the site in your preferred web browser.
  2. Select Site contents from the Settings menu.
  3. Select new subsite from the Subsites section as shown in the following screenshot:
    How to do it...
  4. On the New SharePoint Site page, provide a title, description, and URL for the new site in the Title, Description, and URL fields.
  5. Select the Publishing Site template from the Publishing tab as shown in the following screenshot:
    How to do it...
  6. Click on Create.

How it works...

Site templates in SharePoint provide instructions on how a new site is provisioned. This includes pages, features, lists, libraries, and custom provisioning handlers. The Publishing Site template activates the site scoped publishing feature and creates the libraries for a publishing site.

Note

SharePoint provides two publishing site templates: Publishing Site and Publishing Site with Workflow. A Publishing Site with Workflow template provides built-in workflows to schedule the publishing of content.

There's more...

SharePoint sites may also be created with PowerShell and code using the server-side object model. In PowerShell, the New-SPWeb Cmdlet has been provided for creating new SharePoint sites. In code, we add it to the collection of sites in the site collection object.

Setting up a new publishing site using PowerShell

To set up a new publishing site using PowerShell, use the New-SPWeb Cmdlet to create the site with the complete URL to the new site, the site template, a name, and a description. In addition, indicate that the site will be added to the navigation section (quick launch and top navigation) of the parent site and that the site will not inherit permissions from the parent site.

New-SPWeb -Url "http://sharepoint/publishing" -Template "CMSPUBLISHING#0" -Name "Publishing Site" -Description "A publishing site. " -AddToQuickLaunch -AddToTopNav -UniquePermissions

Tip

Use the Get-SPWebTemplate Cmdlet to get a full list of available templates. CMSPUBLISHING#0 is the identifier for the Publishing Site template.

Setting up a new publishing site with code using the server-side object model

Follow these steps to set up a new publishing site with code using the server-side object model:

  1. Open the site collection in a using statement. For example:
    using (var site = new SPSite("http://sharepoint/"))
  2. Add a new site to the site collection with the relative URL, a name, a description, a language, and the template.
    site.AllWebs.Add("publishing", "Publishing Site", "A site about publishing.", (uint) site.RootWeb.Locale.LCID, "CMSPUBLISHING#0", true, false);

Tip

For the language, we are simply using the language of the root site in the site collection. Any language that has been installed on the SharePoint farm may be used.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.74.160