SharePoint Online:更改搜索框中的“搜索此网站”文本
要求:更改 SharePoint Online 网站搜索框中的“搜索此网站”默认占位符文本。
如何在SharePoint Online中设置搜索框文本?
默认情况下,新式 SharePoint Online 搜索框中的网站搜索框将“搜索此网站”作为搜索标签。我们可以将此占位符文本更改为有意义的内容,以使其更具相关性。例如,将其设置为“搜索操作门户”而不是在操作门户网站中说“搜索此网站”不是更有意义吗?
好吧,这是更改搜索框默认文本的 PowerShell 脚本:
#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/Operations"
$SearchBoxText ="Search Operations Portal"
#Connect to the site
Connect-PnPOnline -Url $SiteURL -Interactive
#Set the default search box text
Set-PnPSearchSettings -Scope Site -SearchBoxPlaceholderText $SearchBoxText
结果:
您还可以在网络级别将搜索框的占位符文本设置为:
Set-PnPSearchSettings -Scope Web -SearchBoxPlaceholderText $SearchBoxText
要重置为默认文本,请使用以下命令:
#Reset to the default search box text
Set-PnPSearchSettings -Scope Site -SearchBoxPlaceholderText ""

