Z .
Z .

Reputation: 12837

URLs of pages on which item appears in Sitecore

In Sitecore, how can I get a list of all pages on which an item appears? Thanks

Upvotes: 1

Views: 1428

Answers (1)

JermDavis
JermDavis

Reputation: 1155

Internally Sitecore maintains a database of references between Items called the Link Database. You can query this by using the "Links" dropdown on the "Navigate" tab on the Content Editor ribbon. That may give you the information you need.

(You can also query the Links Database via code - See example code on http://laubplusco.net/sitecore-item-extensions-get-referrers-as-items/ for one example of doing this - or the docs in SDN)

If the relations to your target Item are via selection field types (multilist, treeview etc) or via the DataSource property of Renderings/Sublayouts/etc then you should be able to select the item you're interested in and click the "Links" dropdown to see a list of the relationships Sitecore has recorded. This will list system relationships (which template does this item use) as well as the sort of relationships you're interested in where one item points at another item.

Note that this approach cannot tell you about some types of relationship: the most common sort being ones which are calculated at runtime. (EG API queries, or searches) because those relationships don't exist in the Links Database.

-- edited to add --

You ask about getting the URLs for these Items. In code you can get the URL for an item by calling LinkManager.GetItemUrl() and passing in the item you're interested in. That gives you the public website URL, rather than the Sitecore Item Path that you'd get directly from the Link Database.

Upvotes: 4

Related Questions