The following steps describe how to create this:
Enable the Content Search Web Part
In the Site Settings, under Site Collection Administration, enable the SharePoint Server Enterprise Site Collection and the SharePoint Server Publishing Infrastructure features. These add the Content Search web part and create the JS files in the Content Web Parts directory.
Upload the template files and css
First, download the the code from the following in github: https://github.com/sregan1/SharePoint-Office365/tree/master/Sites%20DirectoryOpen up SharePoint Designer and select on All Files in the left hand navigation. Then go to /_catalogs/masterpage/Display Templates/Content Web Parts. Copy Control_Sites_Directory.html and Item_Sites_Directory.html here. Edit the url in these files (where it says "vivity.sharepoint.com") to your url.
Go to Site Assets, and create a Styles folder (if not there already), and copy SitesDirectory.css there.
Add the web part and select the templates
First, add a content search web part to your page and edit it. In the dropdowns, select the newly added Sites Directory for the Control and Item Sites Directory for the item.
Setup the web part query
Edit the web part and hit the Change Query button, Switch to Advanced Mode and paste in the following "contentclass:STS_Site" into the Query text box
You might want to remove some sites/paths from the query as needed by using the Property filter (e.g. -Path:https://vivity.sharepoint.com/sites/sitenottoshow). If you want to add subsites as well, make the query text (contentclass:STS_Site OR contentclass:STS_Web).
Map the Site Name to a RefinableString for Search Sorting
You'll probably want these results to be sorted, so to accomplish that, go to your Content Type Hub and go to Site Settings -> Search Schema (under Site Collection Administration), and then search for "RefinableString". Select one, say RefinableString00, and scroll down to Add a Mapping. Map "ows_SiteName" and press OK. Wait a bit (maybe a day), for the index to update. You'll now be able to sort by RefinableString00. [I usually also give the RefinableString an Alias like SiteName, so it's more clear what you're sorting on]
And that should be it!
NOTE: If some sites aren't showing, just kickoff a re-index of the site in Site Settings -> Search and offline availability...
References
The paging functionality was referenced from Sean McDonough's blog here: https://sharepointinterface.com/category/sharepoint-2007/development/
4 comments:
What an extremely wonderful post this is. Genuinely, perhaps the best post I've at any point seen to find in as long as I can remember. Goodness, simply keep it up.360DigiTMG data scientist malaysia
I see the best substance on your blog and I unbelievably love getting them.
training provider in malaysia
This is actually the data I'm searching for, I was unable to have requested a less difficult perused with extraordinary tips this way... Much appreciated!
PMP Certification
This post is easy to peruse and acknowledge without forgetting about any subtleties. Extraordinary work!
difference between analysis and analytics
Post a Comment