Select Page

INTRANETS

show content owners page status using Column Formatting

We have found it useful for page owners to easily see the published status of their pages. Learn how to easily format the column using JSON code.

Image showing how to Convert News Posts to Pages in SharePoint

Show the published status of a SharePoint page using column formatting.

We added the Version column to our Site Pages libraries then formatted it to clearly show our page owners the published status of their pages.  We have had such good feedback from our SharePoint Intranet authors – who tell us that previously that had edited or created content and not actually republished it.

Making the page published status stand out and be clearly seen has supported a number of our intranet authors.  It is such a simple enhancement to support the quality of your intranet content and the page management process that your content owners follow.

You can see the image below showing the Version column and the options –

– Published

– Published with Draft

– Draft with NO published version

 

SharePoint column formatting Page published status

Here’s how to set it up:

  1. In the Site Pages library view click Add column
  2. click Show or Hide columns
  3. choose Version
  4. click Apply
Site pages version column

Now format the Version column so we can add the code to change the formatting of the field based on the published state of the SharePoint page.

  • Hover of the heading of the Version column
  • select Column Settings
  • select Format this column
  • on the formatting pane that opens select Advanced mode
delete all default format code

Delete the default code displayed in the formatting box shown above and paste the code shown below there instead.

Select all the code shown below then Paste into the Advanced formatting box

    {
    “$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
    “elmType”: “div”,
    “attributes”: {
    “class”: “=if(Number(@currentField) % 1 == 0, ‘sp-field-severity–good’, if(Number(@currentField) > 1, ‘sp-field-severity–warning’, ‘sp-field-severity–severeWarning’)”
    },
    “children”: [
    {
    “elmType”: “span”,
    “style”: {
    “display”: “inline-block”,
    “padding”: “4px 8px”
    },
    “attributes”: {
    “iconName”: “=if(Number(@currentField) % 1 == 0, ‘Accept’, if(Number(@currentField) > 1, ‘Warning’, ‘ErrorBadge’))”
    }
    },
    {
    “elmType”: “span”,
    “txtContent”: “=if(Number(@currentField) % 1 == 0, ‘Published’, if(Number(@currentField) > 1, ‘Published with Draft’, ‘Draft with NO published version’))”
    }
    ]
    }

    Save your changes and return to the Site Pages library view – maybe consider moving the version column a little closer to the start to be more accessible by your intranet content owners.

    SharePoint column formatting Page published status
    Campbell Smythe

    Campbell Smythe

    Author

    I am an intranet specialist working in SharePoint and other Microsoft 365 technologies. 

    Recent articles

    SharePoint: Page Checker Chrome Extension

    SharePoint: Page Checker Chrome Extension

    SharePoint Page Checker is a free Chrome extension that scans your SharePoint pages to identify potential issues before they impact your users. Think of it as having a quality assurance expert review every page with just one click.

    SharePoint: Update original First Published Date of a News Post

    SharePoint: Update original First Published Date of a News Post

    I recently needed to update a handful of SharePoint News Posts. The News Posts had been created by copying existing posts and had kept the original FirstPublishedDate, which meant that the posts were being displayed in order based on the original date.
    Here’s a script you can modify and use in order to modify the FirstPublishedDate field on those posts.

    Was this post helpful?

    If this post was helpful the best thing you can do to help us grow is to share it with your friends and colleagues.  Follow us on YouTube, Facebook, Instagram or X to see our new posts supporting intranet managers. 

    SharePoint Modern online logo