0

I'm building a new SharePoint structure for our projects team where each new project is a new subsite created from a site template (Team site). However, the subsites need to be sortable (and searchable) based on certain information: - location - status - etc Do I need to add metadata to the subsites themselves or is it possible to, for example, add a list to the site that contains this information and then reference that information from the CQWP? Is it even possible to add metadata to a site itself?

This way, I could create a CQWP that brings back only sites from a certain location and with a certain status.

As the users themselves will be creating the sites, this needs to be a reasonably simple task.

0

It's not possible to add metadata for SharePoint sites. Therefore you'll need a workaround with a slight compromise. My suggestion is the following:

You can query the (sub)sites using Content Search Web Part by setting your own query. The query such as contentclass:STS_Web path:"https://yourlocation" -Path={Site.URL} does the job.

  • contentclass:STS_Web defines the type of queried items to be SharePoint sites.
  • path:"https://yourlocation" defines the path to be queried including the URL itself and all the subsites below that level. Note that this returns also the possible subsubsites, etc.
  • -Path={Site.URL} excludes the site the web part is located at. This is what you need if you want to search the sites below the current site level, but if you'd search for sites from another location, you could exclude the parent level by e.g. its name - SiteTitle<>SiteName where <> means Not equals.

The query should be modified according to your needs. The sorting can be done in the web part's query settings and as far as I know, this is the only way to sort the sites on a wp using OOTB features.

As your requirement is to have some sort of metadata along the returned items, you could do that with the Content Search Web Part's Display Template Two lines. You probably need to have the link to the site and the metadata, so I'll explain them:

For "metadata", your easiest shot is to return the Description of the site. This is the one added during the site creation process, or afterwards on the site's Site Settings on Title, decription, and logo -options. This is probably the one step where the users need to be instructed if the process is not administered.

For the link you need to customize an available property. From the site collection's root level access Search Schema -settings, search for an available (non-customized) RefinableStringXX where XX is a number from 00 to 99. Choose Edit/Map Property for the selected property. On the Mappings to crawled properties open Add a Mapping, search for ows_SiteName and add it. Now you can use the customized RefinableString property on the CSWP.

Note that the changes to the customized property will be applied during the next incremental crawl. The same applies for the CSWP generally - the crawled items will update after the incremental crawls.

Again a workaround for your requirement to return sites with certain status would be to consider the structure of your project sites. You could e.g. have a site level for different project statuses (/Active/, /Completed/, /Cancelled/, ...) so that you can search sites based on their path. Sites after all can be moved with the built-in Content and Structure tool. This either requires administrative person or a proper training for the site owners.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.