Forum Discussion
SharePoint Online Homesite shows HOME rather than name of the site or group
As a user of the SharePoint online home site page
/_layouts/15/sharepoint.aspx
or the SharePoint iOS app my users find it hard to select the correct site because most sites are listed as "HOME".
This is the SharePoint online home site page , illustrating the problem.
I discovered this about 2 years ago, and hoped that MS would do something about it but as nothing has happened yet, I spend today updating all our 328 SharePoint sites so that they will display a useful human readable name on the SharePoint online home site page and in the iOS SharePoint app.
Over the past couple of years I've discovered that the SharePoint online home site page is displaying the Title of that site's home page.
If you update the file properties of that site's Home Page, then the name displayed in the SharePoint online home site page updates. But you have to wait for the search service to re-index the site. In my case it takes about 2 hours.
This image shows what is displayed and where it comes from.
So what I set out to do was get a list of all SharePoint sites in my tenant, then go through each, find the home page and if it's Title property was set to "Home" then change it to match what is shown to users when they go to that site.
I tried to do this in less than 3 hours (it took about 5) so I thought I would share the code.
This code is rough, but it worked for me so I hope it works for you.
I requires the user running it to have the right to access the SharePoint Tenant admin site, and have access to all the sites within the Tenant.
[When I ran it the account I was using didn't have access to every site, so it did fail, but continued after showing error messages].
You could potentially change this code and just use it against specific sites your account has rights to, but you'll have to come up with your own $allSites object.
#Powershell script
# Goal
# update all tenant sharepoint site home page titles so that they don't say HOME but reflect the actual name of the site.
# this is to fix the issue of SharePoint ios app and SharePoint web page showing sites with Home as the label.
#connect to admin tenant and get list of all sites
$tenantName = "Contoso"
Connect-PnPOnline -Url "https://$tenantName-admin.sharepoint.com" -useweblogin
#get a list of all sites in the tenant
$allSites = Get-PnPTenantSite -detailed | select title,url,owner, LastContentModifiedDate, WebsCount, Template, StorageUsage
$allSites = $allsites | sort-object -property title
#an object which you can export to CSV later , so you have a list of all the things this script changed
$whatWaschanged = @()
foreach($site in $allsites) {
write-host "Working on >> " $site.title " || " $site.url #visual clue as to what is going on
$thisSiteTitle = ""
If($Site.Title.length -gt 26) {
$thisSiteTitle = $site.title.replace('a','').replace("e","").replace("i","").replace("o","").replace("u","")
} else {
$thisSiteTitle = $site.title
}
#$thisSiteTitle
#write-host $site.Template
if($site.Template -eq 'TEAMCHANNEL#0') {
#do nothing
#write-host "hello"
} else {
#connect to each site
connect-pnponline -url $Site.url -useweblogin
#makes long titles shorter
$thisSite = get-pnpweb
#find home page for the site
$thisSiteHomePageRelURL = get-pnphomepage
$thisSiteHomePageRelURL = $thisSiteHomePageRelURL.ToLower()
#$thisSiteHomePageRelURL
#will give back SitePages/home.aspx or similar
$thisSiteHomePageIdentity = $thisSiteHomePageRelURL.replace('sitepages/','') #works for templates Group#0 and #sitepagepublishing0
#get just the homepage
$thisSiteHomePageFile = get-pnppage -identity $thisSiteHomePageIdentity
#check home page title
If ($thisSiteHomePageFile.PageTitle.ToLower() = 'home')
{
$thisSiteHomePagelayouttype = ""
$thisSiteHomePagelayouttype = $thisSiteHomePageFile.layouttype
#update title of the home page
set-pnpPage -identity $thisSiteHomePageIdentity -Title $thisSiteTitle
#set layout type to what it was, or the page layout will change from Home to Article when the title is updated using this powershell
set-pnppage -identity "home.aspx" -LayoutType $thisSiteHomePagelayouttype
write-host "Changed >>" $site.title
$whatWaschanged += @{SiteChangedTitle=$site.title; SiteChangedURL=$site.url}
}
#move to next site
}
}
$whatWaschanged #writes to the powershell window the sites that have been updated
Two issues that came up which you'll see in the code
- If the $Site.Title is longer than 26 characters I shorten it by removing all vowels. Not pretty but it works
- I reset the LayoutType of the page I change the Title of back to what it was before I changed the Title. I do this because when I ran it without this the home page's changed from LayoutType = Home to LayoutType = Article which means the page banner is shown (with background image etc). To avoid this I added in the rest of the LayoutType to whatever it was prior to changing the Title.
Do you need to publish the site's home page after the change ?
No. I didn't find that I had to do this for any site other than one, and I suspect that the home page may have been already checked out but not published in that case.
Did it work for every site ?
No - I found this didn't work for sites with $site.Template -eq 'TEAMCHANNEL#0' - these are the private channel's of Team sites I believe. I only have less than 10 of these in my Tenant so I didn't care it didn't work for them but to reduce errors I check for this Template and skip it.
I hope this helps you
4 Replies
- vaniCopper ContributorWe had the same issue in our tenant and were able to get it resolved (had a ticket open with Microsoft for 8+ months but we got there eventually)
In case anyone else has this issue, here's what we did to solve it. You'll need the SharePoint admin role and (probably) a ticket open with Microsoft to recrawl your SharePoint sites.
1. In the SharePoint Admin center -> More features -> Search -> Manage Search Schema
2. Filter/search for "Title", then click Title to open its settings
3. Scroll down to the very bottom to "Mappings to crawled properties" and move "Basic:displaytitle" so it's at the top of the order. Hit OK.
4. Wait 72 hours
5. Have Microsoft recrawl all your SharePoint sites on the back end (or you might be able to just wait a bit?)
Hope this helps, good luck out there!- Dorje-McKinnonIron Contributor
vani Doh! it makes so much sense that it is the search "Managed properties" order that is the problem.
On
My tenant's "mappings to crawled properties" field was
- Title
- title
- ows_Title
- TermTitle
- ows_BaseName
- MailSubject
- Mail:5
- People:PreferredName
- Basic:displaytitle
- Basic:#10
- Basic:#9
- MetadataExtractorTitle
- MetadataExtractorTitle
I moved
- Basic:displaytitle
to the very top.
We have a long weekend here in New Zealand so I've taken a copy of
https://MyTenant.sharepoint.com/_layouts/15/sharepoint.aspx?v=following
And I'll compare it to the same page next week and let you know how it goes.
Many thanks for replying to this very old post 🙂- vaniCopper ContributorDid it work for you? I'm dying to know!