When working in the Site Contents area of Communication Sites, within the Site Pages area, I find it quite difficult to see which are ‘news’ and which are ‘pages’.
So when is a page, a news item? – when it is promoted. The key differentiator is the “Promoted State” column and this post talks a little about showing which content is promoted.
There are a few ways that you can highlight promoted content, you can ‘Group by Promoted State’, create views using filters, but I have gone for a third option, to use the new ‘View and Column‘ feature.
For these examples, as a minimum, add the “Promoted State” column to the view, by clicking the Add Column button. You will notice that the column (if you have lots of content) will have the following states:
0 – Not promoted
1 – Promoted as News after publishing
2 – Promoted as News
For a news item to show it must have a state of 2 to be a news item. Although state 1 items still represent a promoted state, I have not yet come across a scenario in which these are used (feel free to use the comments to help me out here!).
Note: If you do not add or later remove the “Promoted State” column, the formatting will not show.
Setting the column
In the site pages, select the drop-down for “Promoted State”, select “Format this column” then you can paste in the following code:
|"padding": "0 4px"|
|"iconName": "=if(@currentField == 0, 'Page', 'News')"|
This will place an icon to represent a page or news item in the place of the number. It just makes it easier to quickly identify the two types of page. Its not perfect. If Microsoft release a new state then an update to the above will be needed.
Setting the row formatting
When using row formatting, you can specify JSON formatting to enable the whole row to be highlighted when the promoted item is greater than 0. In the site pages library, select the drop-down for views and choose “Format this View” and paste in the below statements:
The code is very simple but effective for a visual enhancement.
The column is of type ‘Number’ to mark content, this leaves it open for more representations of different type of content in the future and this sample may need some adjustment. From Ignite, there is the concept of organisational news, not sure yet what that would look like in terms of feature. In theory, Microsoft may use this column to tag pages as organisational news.
In the future, this type of input may be replaced with a new friendlier way to highlight content, in PnP community call (General SharePoint Dev Special Interest Group (SIG) – October 4th 2018), there are references to “Easier column formatting” that may eventually replace the above implementation.