Azure / Office 365 / SharePoint Development / Search

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.

Team news functionality

Team news functionality

Info: SharePoint Online "team news" begins roll out to Office 365 First Release customers - https://techcommunity.microsoft.com/t5/SharePoint-Blog/SharePoint-Online-team-news-begins-roll-out-to-Office-365-First/ba-p/22763

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.

Info: New page URL - https://tenant.sharepoint.com/sites/Team/SitePages/newpage.aspx?Mode=Edit

Both pages also look the same:

News page and site page layout

News page and site page layout

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

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.

News page

Site page

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

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.

You will see a similar output:

Added the publish date

Added the publish date

I hope this gave you some insights into how the new news page functionality works behind the scenes.

Comments

  • unnie ayilliath

    Good post. Is this webpart and news page feature available for non-team sites also?

    • On my environment, it is only available for the group team sites.

      • Larry Tenison

        I was able to jury-rig a pre-existing team site to use the new site page content type. I simply added a new site page to the Site Pages library, then swapped it in as home.aspx, and I now have a News page for my old team site.

  • Peter Cuttriss

    Great post Elio. Thank you for this insight. Just an FYI, I think you’ve got your Site Page and News Page code screen shots around the wrong way.

  • Hans Worst

    The URL behind the button ‘Add news’ is:
    ……./_layouts/15/CreateSitePage.aspx?source=%2Fsites%2Fmyfirstteam%2FSitePages%2FHome%2Easpx&promotedState=1
    so this default value for promotedState is not correct to let it show up as a news page.

    • In fact it is. When you create a news page, the initial value of the promotedState will be set to “1”. Like you show in the “add news” URL. This will be the draft version of your page and will stay draft until you publish the page. Draft versions aren’t displayed via the news web part. Once you publish a news page, the promotedState value will be set to “2”.

      • Hans Worst

        Ok, cool. But even if the news page is published the promotedState is zero and the FirstPublishDate isn’t filled out automatically (yet), so it won’t show up anyway, right?
        Do I miss something or is this a bug?
        Thanks!

        • It only checks the promotedState. When you create a new news page it should automatically get the promotedState value assigned. Are you experiencing something else?

  • Larry Tenison

    Great post, Elio. I have a general question. Does anyone know where those 3 default links in the News Headline web part are coming from? They all point off to Microsoft pages. Are they hard-coded some place? Can they be changed?

    • The web part contains a couple of hard-coded links to pages, so they are not changeable at this time.

  • Tomas Axell

    Great article!, but I was wondering where do you set the PromotedState=2 on the content on the page as you are talking about in the article?

  • Olivier Morel

    great article ! I posted several news but I would like to display an older news on the left side (same position as “Another site page” on the screenshot above. I can’t find how to do this. If I update the FirstPublishedDate in the aspx page is it going to work ? if yes how should I proceed to update it ? thanks!

    • Yes, it is based on the publish date. At the moment it seems that you cannot update it via the interface. You could download the aspx page, update its content and re-upload it to the site pages library. Updating it via PowerShell would be another option.

  • Pingback: How to work with modern News in classic SharePoint Online sites - Balestra - Balestra()

  • Pingback: PromotedState : la différence entre « Page de site  et « Actualité  | «Mes petites découvertes sur Office 365()

  • MV.

    I am just bumping into this as a non-technical user trying to use SharePoint… There is no way to add an existing page to News Headlines other than to futz around with code like this? Are you freaking kidding me? As it seems, I have to recreate pages just to get it to show up. And even then, until I have enough news feeds, I get those ones from Microsoft still showing up there.
    This is why end users like me who need to get real work done and don’t have time to screw around with code and spend 2,000 hours dithering around in SharePoint intricacies will abandon the tool and go right back to email and network folders.

    • That is correct, recreating the pages is enough. The post just shows the differences between a site page and a normal page that does not show up in the headlines web part.

      Hopefully MS will make the process of updating the dates a bit simpler in the future.

  • CSJU

    Hello,
    Is there a better way to get alerted when news is posted? I tried setting up an alert on the library but some of the alerts are coming out with what I would call the internal page name instead of the actual page name. Something like “8czzwp4k.aspx has been changed” but this isn’t as helpful as it could be. Any insight you have on this would be great. Thanks in advance.

    • Maybe you can try to create an Microsoft Flow to send you an email when a page has been modified. In flow you can work with conditions, so that would allow you to filter out the changes you are interested in.

  • Sandy

    Cool, thanks, Elio! I was just wondering about this, as I was writing a blog post about all of the Modern web parts. I’ll link to your blog when I mention this :-)
    See you soon in Cambridge!!

    • Sandy

      Ha! As I thought a bit more about this, and read the other people’s comments about how difficult it is to change these attributes, I thought: I could probably do this with the Lightning Tools Data Viewer Add-in! So I tested it, and it was super easy :-) You just point the DV to the Site Pages library, display the PromotedState and FirstPublishDate, enable in-line editing, and bingo – I set those attributes and thus “promoted” a regular Site Page to be a News Page :-D I also checked that I could easily change the FirstPublish date to bump a page to the top :-) This is awesome!

  • Pingback: Modern SharePoint Web Parts - Part 2 - Aurora Bits - Innovative SharePoint Solutions & Tools()

  • Thanks a lot for this article, Elio! It clarified a question I was pondering on for some days in the context of the new Communication Sites. Same thing there.