Вопрос

I have noticed this new feature in SharePoint Modern Site pages in my O365 SP Online site. Can someone tell me on what basis this page-view is calculated (e.g - weekly, monthly or it shows the total page views since the inception/creation of this modern site page.? Also, I want to hide these from other site users. How can I do so.?

  1. I do not prefer choosing SPFX Application customizer and using CSS to do this. (tried and working)
  2. Though, I am able to remove the "Comment" option by disabling it at edit/publish page level

Refer SS:

Modern Page views

Это было полезно?

Решение

In my experience, it shows the total number of page views since page creation. Though, the method to calculate page views is not known to me, so it could be different. Its not stored in any hidden list or something, but in some data store for which we dont have any API yet.

The Social Bar will appear on all modern SharePoint Online pages with the exception of the home page of a site. It will give your users the ability to like a page, see the number of views, likes, and comments on a page, and see the people who have liked a page. This visibility will be available to anyone that has been granted access to view the page.

This is what appeared in the message center.

To disable it at tenant level, you can use below PS command:

Set-SPOTenant -SocialBarOnSitePagesDisabled $true

or using PnP

Set-PnPTenant -SocialBarOnSitePagesDisabled $false

To disable it at site collection level, you can use below PS command:

Set-SPOSite -Identity <site-coll-url> -SocialBarOnSitePagesDisabled $true

You need to ensure that your SPO PowerShell is the latest version or atleast a version after Feb 2018.

Also, looks like it can't be disabled on modern team sites because of a bug on the Microsoft end of things. Works fine on Communication sites.

So, to answer your question:

It will be visible to all users who have read rights on the page. If you want to hide it for certain group, use application customizer (not recommended though because Microsoft controls the rendering and if the DOM structure changes, you will have to modify the code, better disable it for all users or show it to all users IMHO)

Другие советы

Using PnP both

Set-PnPTenant -SocialBarOnSitePagesDisabled $false 

and

Set-PnPSite -SocialBarOnSitePagesDisabled $false 

works.

Set-SPOSite -Identity <site-coll-url> -SocialBarOnSitePagesDisabled $true

Does Not work for my modern communication sites

Install latest Microsoft Online Management shell version in your machine and run the below script which will address this issue.

#Set Parameters
$AdminCenterURL="https://yourtenant-admin.sharepoint.com"
$SiteURL = "https://yourtenant.sharepoint.com/sites/sitecollectionName"
 
#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)
 
#Disable Social Bar on Site Pages
Set-SPOSite -Identity $SiteURL -SocialBarOnSitePagesDisabled $true
Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top