Find all the item that is using a common Sublayout

2019-04-29 04:37发布

Is it possible to obtain a list of all the items in sitecore that is using common sublayout or XSLT's in presentation tab for rendering i.e. suppose there is sublayout called layout1.ascx that is being used by 5 items.is it possible to obtain the list of all these 5 items by search method.

Thanks in advance.

Regards, Divya

标签: sitecore
2条回答
Anthone
2楼-- · 2019-04-29 05:15

You probably need to do this in two steps (or one if it's only 1 template).

You need to use the Link database.

The simplest way of seeing these "links" is to go to the Sublayout or Rendering and go to the "Navigation" menu and then click on "Links". This should show you all the items that point to this current item and all the items that the current items points to (ie. both ways).

This will probably give you a list of templates and/or items (if the sublayout is set directly on an item).

Then go to a template and see how do the same to see which items are have a refernce to the template.

This should show you which items are using which sublayouts.

Of course this requires the Link database is up to do (should be done automatically, but you can force this with Start > Control Panel > Databases > Rebuild Link Database) and that the Sublayouts etc are bound in Sitecore..

I hope this helps.

查看更多
太酷不给撩
3楼-- · 2019-04-29 05:26

The Link database suggestion is great, but if your sublayout is used by hundreds of items, it may take a little while to load.

Another alternative is this fast query:

fast://*[@__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%' or @__Final Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']

This can be run in the developer center, under Tools > XPath Builder (or for Sitecore 8.x the XPath Builder can be found at /sitecore/shell/default.aspx?xmlcontrol=IDE.XPath.Builder).

Sitecore 9.x no longer supports the XPath Builder, but you can still run this if you install the Sitecore PowerShell Extensions.

The following command can be run:

Get-Item -Path "master:" -Query "fast://*[@__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%' or @__Final Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']"

Change the guid above as needed.

查看更多
登录 后发表回答