SharePoint 2013 custom blog default page and post page

This article shows you how to customise SharePoint 2013 Blog Post’s look on the Home page.

From:

19-04-2017 2-47-09 PM

To:

19-04-2017 3-13-21

In the Posts list library:

Add new columns Body2, Body3, Body4

19-04-2017 3-28-46 PM

19-04-2017 3-33-55 PM

Note: Multiple lines of text, enhanced rich text

  • Go to Site Setting,  Site columns
  • Create a new Site columns
  • Add image columns : Page Image, Post image, Post image3, Post image4
  • 24-04-2017 12-04-20 PMGo back to Post Library, Add from existing site columns
  • 19-04-2017 3-28-57 PM

 

 

Follow the following steps to customise the Blog Post look:

  • Copy the Blog Post layout template ‘blog.xsl’ from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL from a SharePoint web front server and store it somewhere that is visible the Blog site.

In this example, I will create a folder called xsl under the Blog site root folder and store the xsd there. I will also rename it to BlogPost.xsl

  • Open the BlogPost.xsl in SharePoint Designer 2013 and look for the section with start with this comment

<!– BaseViewID=’0′ and TemplateType=’301′ is Home Page view for Blog’s posts list –>

  • Find the
    that define the layout for PostCategory and add the following text after

19-04-2017 4-32-58 PM

 

<table dir="None" cellspacing="0" cellpadding="0" width="100%" border="0">

<tr>
<td> 
 
 <xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='PublishingPageImage' and not ($thisNode/@PublishingPageImage='')">
 <!-- output the Page Image field as " page Image " followed by the categories -->
 <table cellspacing="0" cellpadding="0" border="0" align="right">
 <tr>
 <td valign="top" style="padding: 10px 0 10px 10px;">

<xsl:apply-templates select="$Fields[@Name='PublishingPageImage']" mode="PrintField">
 <xsl:with-param name="thisNode" select="$thisNode"/>
 </xsl:apply-templates>
 </td>
 </tr>
 </table>
 
 </xsl:if>
 </xsl:for-each>
 
 <xsl:if test="$ShowBody=1">

 </xsl:if>
 
</td>
</tr>
</table>
 
 
<table dir="None" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td> 
 
 <xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='Post_x0020_image' and not ($thisNode/@Post_x0020_image='')">
 <!-- output the Page Image field as " page Image " followed by the categories -->
 <table cellspacing="0" cellpadding="0" border="0" align="right">
 <tr>
 <td valign="top" style="padding: 10px 0 10px 10px;">

<xsl:apply-templates select="$Fields[@Name='Post_x0020_image']" mode="PrintField">
 <xsl:with-param name="thisNode" select="$thisNode"/>
 </xsl:apply-templates>
 </td>
 </tr>
 </table>
 </xsl:if>
 </xsl:for-each>
 

<xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='Body2' and not ($thisNode/@Body2='')">
 
 </xsl:if>
 </xsl:for-each>
</td>
</tr>
</table>


<table dir="None" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td> 
 
 <xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='Post_x0020_image3' and not ($thisNode/@Post_x0020_image3='')">
 <!-- output the Page Image field as " page Image " followed by the categories -->
 <table cellspacing="0" cellpadding="0" border="0" align="right">
 <tr>
 <td valign="top" style="padding: 10px 0 10px 10px;">

<xsl:apply-templates select="$Fields[@Name='Post_x0020_image3']" mode="PrintField">
 <xsl:with-param name="thisNode" select="$thisNode"/>
 </xsl:apply-templates>
 </td>
 </tr>
 </table>
 </xsl:if>
 </xsl:for-each>


<xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='Body3' and not ($thisNode/@Body3='')">
 
 
 </xsl:if>
 </xsl:for-each>
</td>
</tr>
</table>

<table dir="None" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td> 
 
 <xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='Post_x0020_image4' and not ($thisNode/@Post_x0020_image4='')">
 <!-- output the Page Image field as " page Image " followed by the categories -->
 <table cellspacing="0" cellpadding="0" border="0" align="right">
 <tr>
 <td valign="top" style="padding: 10px 0 10px 10px;">

<xsl:apply-templates select="$Fields[@Name='Post_x0020_image4']" mode="PrintField">
 <xsl:with-param name="thisNode" select="$thisNode"/>
 </xsl:apply-templates>
 </td>
 </tr>
 </table>
 </xsl:if>
 </xsl:for-each>
 
 


<xsl:for-each select="$Fields"> 
 <xsl:if test="@Name='Body3' and not ($thisNode/@Body4='')">
 
 </xsl:if>
 </xsl:for-each>
</td>
</tr>
</table>

 

Note: @Name should be set to the correct field name syntax. To access the list’s xml data, follow the instruction here http://vspug.com/dwise/2008/01/10/accessing-sharepoint-xml/

  • Save changes to the BlogPost.xsl file,  In SharePoint Designer, upload this file in the blog site (e.g. subsite > All Files > Lists > Posts > xsl > blog.xsl)
  • Locate the default.aspx in SharePoint Designer (Click All Files on the left navigation in the blog site), right click to select Edit File in Advanced Mode
  • Locate <ViewFields> in the source
  • Add the below highlighted fields
    19-04-2017 4-40-36 PM

    <FieldRef Name="PublishingPageImage"/>
     <FieldRef Name="Post_x0020_image"/>
     <FieldRef Name="Body2"/>
     <FieldRef Name="Post_x0020_image3"/>
     <FieldRef Name="Body3"/>
     <FieldRef Name="Post_x0020_image4"/>
     <FieldRef Name="Body4"/>
  • Remove the AllowPersonalization= “false” attribute from the WebPartZone above the ListViewWebPart for Post  (http://blogs.catapultsystems.com/mpoole/archive/2011/08/15/sharepoint-zoning-issues.aspx)
  • Save changes to the default.aspx
  • Browse the default.aspx page and click on Site Actions\Edit Page
  • Edit Posts Web parts
  • Click Miscellaneous and insert the XSL Link (location where you saved the blog.xsl)
  • 19-04-2017 4-47-29 PM
  • Click OK to apply the change and preview the page.

The blog homepage should be showing your new change.

The final step is to modify the post.aspx so when you click on the title link of each post, the new change is also reflected.

Result:

19-04-2017 4-55-48 PM

Go to SharePoint Designer, navigate to your blog site > All Files > Lists > Posts

20-04-2017 3-12-30 PM

  • Locate post.aspx
  • Right click to select Edit File in Advanced Mode
  • Locate <ViewFields> in the source
  • Add the below highlighted fields19-04-2017 4-40-36 PM

 

<FieldRef Name="PublishingPageImage"/>
 <FieldRef Name="Post_x0020_image"/>
 <FieldRef Name="Body2"/>
 <FieldRef Name="Post_x0020_image3"/>
 <FieldRef Name="Body3"/>
 <FieldRef Name="Post_x0020_image4"/>
 <FieldRef Name="Body4"/>
  • Remove the AllowPersonalization= “false” attribute from the WebPartZone above the ListViewWebPart for Post
  • Save and check in Post.aspx
  • Preview your new blog post in the homepage and click the post title to confirm the post.aspx are showing the new fields.

(Credit: Thanks for reference: https://devdotnotes.wordpress.com/2012/01/27/how-to-customise-sharepoint-2010-blog-post/#comment-110)

Advertisements

SharePoint Save library as template

“Save library as template” link is missing in SharePoint site

Some of the document libraries and list, “Save library as template” link is hidden by default. If you go to  “View All Site Content” and have a look at the description next to each library/list, the description that says “This system library was created by the Publishing feature..” will have the “Save library as template” link hidden.

This behaviour is by default, however we have a workaround for this. Go to the “Document Library Settings” page. You should see the URL address like this “…/listedit.aspx?List={GUID}”, change the “listedit” to “savetmpl” and the URL look like this “../savetmpl.aspx?List={GUID}”, now you will be able to save the library as a template.

This method is not recommended, but it works. If you have any workflow bound to the library then you may have some issues,but works fine if you just want to create a template for document settings, Columns and views.

Ref: http://sharepointserved.blogspot.com.au/2011/05/save-library-as-template-link-is.html

SharePoint designer 2013 approval workflow with dynamic approver from a custom list

This article will show you how to create a simple custom list where you can pick a person as an approver from People picker (Active Directory). Then this approver will receive an email notification to approve or decline the request. The requester will receive an email confirmation to say the request is submitted and be notified when the request is approved or declined with approver’s comments on the email.
The approver receive an email with a link to the Workflow Tasks where they can enter comments and click approve or decline button.

Create a custom list: (Where users submit their requests)

Click Site Contents > add an app > Custom List

Enter Name “Change Request” > click Create

Open “Change Request” list

In the top ribbon > click List tab > click List Settings

Click Create column > enter following information

Column name: Approver

Type: Person or Group

Require that this column contains information: Yes

Enforce unique values: No

Allow multiple selections: No

Allow selection of: People Only

Choose from: All Users

Show field: Name (with presence)

Leave the tickbox Add to default view ticked.

Click OK


Then create another column for requester to enter notes.

Click Create column > enter following information

Column name: Notes

Type: Multiple lines of text

Require that this column contains information: No

Number of lines for editing: 5

Specify the type of text to allow: Plain text

Append Changes to Existing Text: Yes

Click OK

change-request-list

This list will be used for user to create a new item – enter notes and select an approver from People picker.

Title – mandatory field
Approver – mandatory field
Notes – optional field


Creating Workflow:

Go to SharePoint Designer 2013

Click Workflows from left navigation

In the top ribbons, click List Workflow > click Change Request (custom list you just created)

Enter Name: Approval Workflow

Platform Type: SharePoint 2013 Workflow

Click OK

approval workflow

In Workflow Ribbon > Action > “Set Workflow Status” > Enter “In progress”

Below of this action, add new action “Set Workflow Variable
click “Workflow Variable” > “Create a new variable” > Set Name “Approver1” and Type “String“.

click value > click function icon > set following values:

Find Data to Retrieve:
Data source: Current Item
Field from source: Approver
Return field as: Login Name

approver1value

Click OK

Below of this action, add new action > “Assign a task

Click “this user“, click … for participants
Select “Workflow Lookup for a User” > Add
Select Data Source “Workflow Variables and Parameters
Field from source : Variable: Approver1, Return field as: As String
Click OK

Below of this action, add new action > “Set Workflow Variable
Click “workflow variable” > click the drop down Create a new variable…
Name: comments
Type: String
Click OK

Click “value” and click function icon
Field Data to Retrieve
Data source:  Workflow Tasks
Field from source: Description
Return field as: As String
Find the List Item
Field:GUID
Value: click the function icon
Data source: Workflow Variables and Parameters
Field from source: Variable: TaskID
Return field as: As String
Click OK
comment-value

Back to the workflow screen
Below of this action, add condition > “if any value equals value
Click value > function icon
Data source: Workflow Variables and Parameters
Field from source: variable: Outcome
Click OK
Click value drop down > select Approved
Below of this action, click add action > Set Workflow Status to 
In this message: Type Approved 

Below of this action, click add action > Send an email
Click these users
To: Click Address icon
Click Workflow Lookup for a User …
Data source: Current Item
Field from source: Created By
Return field as: Email Address
Click OK

Click Workflow Lookup for a User …
Data source:Workflow Variables and Parameters
Field from source: Variable: Approver1
Return field as: Email Address
Click OK

Subject: click … icon
Type Change Request is approved
Click Add or Change Lookup button
Data source: Current Item
Field from source: Title
Return field as: As String
Click OK

Email Body
Use Add or Change Lookup button to insert the fields as the following:
approve-email

insert-field

Click OK

Below this action, in the top ribbon, click Else Branch
click add action > Set Workflow Status to 
In this message: Type Declined

Below of this action, click add action > Send an email
Click these users
To: Click Address icon
Click Workflow Lookup for a User …
Data source: Current Item
Field from source: Created By
Return field as: Email Address
Click OK

Click Workflow Lookup for a User …
Data source:Workflow Variables and Parameters
Field from source: Variable: Approver1
Return field as: Email Address
Click OK

Subject: click … icon
Type Change Request is declined
Click Add or Change Lookup button
Data source: Current Item
Field from source: Title
Return field as: As String
Click OK

Email Body

decline-email

Click OK.

Below this action > Transition to stage

Double Click (Insert go to actions with conditions for transitioning to the stage)

In the top ribbon > Click Action > Go to a stage

Click a stage > End of Workflow

Your final workflow should look like the below:

workflow

In the top ribbon > click Save

Click Publish


Set up a custom content type of Workflow Task (SharePoint 2013)

Go to site collection level (top level) > click Site Content Types

Click Create > enter the following information

Name: change request workflow

Select parent content type from : List Content Types

Parent Content Type: Workflow Task (SharePoint 2013)

Group: Existing Group: Custom Content Types

Click Start Date column > Column Settings > select Hidden > click OK

Click Due Date column > Column Settings > select Hidden > click OK

Click Assigned To column > Column Settings > select Hidden > click OK

Click Predecessors column > Column Settings > select Hidden > click OK

Click Priority column > Column Settings > select Hidden > click OK

Column Order should be:

Task Name
Description
% Complete (This cannot be hidden or deleted)
Task Status
Related Items
Task Outcome (This has to be the last one in order to have the approve and decline buttons to show)