AlertThis post is over a year old, some of this information may be out of date.
What makes a page to be a news page on SharePoint Online
October 28, 2016
Yesterday our tenant got the new team news functionality. This functionality allows you to write news in your team site which gets published on the homepage or via the new news headlines web part.
As I started testing out the news page functionality. I questioned myself how they achieved it, because creating a new news page redirects you to the same URL as for creating a new site page.
So, as they look and feel the same, where is the difference? You would think metadata, and this in fact true, but you cannot see it from the UI. If you would check the properties from the UI, you will only see its Title and Name. Now, when you open the content type of the page which is Site Page (also for the news pages). You will see the following metadata fields:
Site page content type
Here you find the answer. There are a couple of metadata fields which are hidden from the UI like Promoted State and First Published Date. When you check the contents of the ASPX page. You will see a couple of differences between the two types of pages.
<%@ Page language="C#" Inherits="Microsoft.SharePoint.WebControls.ClientSidePage, Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<htmlxmlns:mso="urn:schemas-microsoft-com:office:office"xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head><!--[if gte mso 9]><SharePoint:CTFieldRefs runat=server Prefix="mso:" FieldList="FileLeafRef,ClientSideApplicationId,PageLayoutType,CanvasContent1,BannerImageUrl,BannerImageOffset,PromotedState,FirstPublishedDate"><xml>
<mso:CustomDocumentProperties>
<mso:PageLayoutType msdt:dt="string">Article</mso:PageLayoutType>
<mso:ContentTypeId msdt:dt="string">0x0101009D1CB255DA76424F860D91F20E6C4118</mso:ContentTypeId>
<mso:ClientSideApplicationId msdt:dt="string">b6917cb1-93a0-4b97-a84d-7cf49975d4ec</mso:ClientSideApplicationId>
<mso:PromotedState msdt:dt="string">0</mso:PromotedState>
<mso:CanvasContent1 msdt:dt="string"><div><div data-sp-canvascontrol="" data-sp-controldata="%7B%22controlType%22&#58;4,%22displayMode%22&#58;2,%22id%22&#58;%2295c72cb5-c819-458c-96e3-b0fd63b5f367%22,%22innerHTML%22&#58;%22%3Cp%3EThis%20is%20just%20another%20site%20page%3C/p%3E%22,%22editorType%22&#58;%22Quill%22%7D"><p>This is just another site page</p></div></div></mso:CanvasContent1>
<mso:BannerImageUrl msdt:dt="string">https://tenant.sharepoint.com/_layouts/15/images/sitepagethumbnail.png, /_layouts/15/images/sitepagethumbnail.png</mso:BannerImageUrl>
</mso:CustomDocumentProperties>
</xml></SharePoint:CTFieldRefs><![endif]--><title>Another site page</title></head>
In the news page, you can find two important differences: PromotedState = 2.00000000000000 and the FirstPublishedDate which is defined.
A site page does not contain the FirstPublishDate element and the PromotedState value is set to 0.
So, what makes a page a news page?
As it turns out, the PromotedState value needs to be set to 2 to display it via the news headlines web part. When you change the number of the site page content, it will be displayed in the news headlines web part:
Promoting a site page to a news page
In the screenshot, you can see that my site page article now gets displayed, but something seems to be wrong with the date. This is where the FirstPublishDate fits in. When you add this to the content of the site page and refresh the homepage.