# Get pages where a document has been used

**URL:** <https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [February 21, 2019, 11:04am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835 "2019-02-21T11:04:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Raj](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/rahul_raj/32/329_2.png) [@Rahul\_Raj](https://community.bloomreach.com/u/Rahul_Raj)\
**Post date:** [February 21, 2019, 11:04am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/1 "2019-02-21T11:04:59Z")

</div>

Hi All,

I want to retrieve a document based on search key and need to find all the pages where this document is being used. I tried with fluent search, it gives me the document with the search and on search result page i also get the page link where this document is used(through \<@hst.link var=“link” hippobean=item /\>).

However, if the same document is used for two pages, it still just return one result. For my requirement it should return me 2 results and with their link for page. Can you please help, how could i achieve this?

Also, is there a way to get the page in my searchComponent itself(java class).

Thanks  
Rahul

---

<div class="post-metadata">

**Author:** ![machak](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/machak/32/1298_2.png) [@machak](https://community.bloomreach.com/u/machak)\
**Post date:** [February 21, 2019, 11:26am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/2 "2019-02-21T11:26:11Z")

</div>

use HstLinkCreator.createAll() method

---

<div class="post-metadata">

**Author:** ![Rahul\_Raj](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/rahul_raj/32/329_2.png) [@Rahul\_Raj](https://community.bloomreach.com/u/Rahul_Raj)\
**Post date:** [February 22, 2019, 8:10am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/3 "2019-02-22T08:10:36Z")

</div>

It worked. Thanks a lot.

Rahul

---

<div class="post-metadata">

**Author:** ![Rahul\_Raj](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/rahul_raj/32/329_2.png) [@Rahul\_Raj](https://community.bloomreach.com/u/Rahul_Raj)\
**Post date:** [February 27, 2019, 6:37am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/4 "2019-02-27T06:37:40Z")

</div>

Hi Machak,

I want to capture the pages where a document has been used, but at the time when the document gets published. How can i get that please suggest. I get requestContext null in CMS module.

Thanks  
Rahul

---

<div class="post-metadata">

**Author:** ![machak](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/machak/32/1298_2.png) [@machak](https://community.bloomreach.com/u/machak)\
**Post date:** [February 27, 2019, 9:37am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/5 "2019-02-27T09:37:12Z")

</div>

see this thread:

> [@Getting the document path (HippoCMS rendered) in the REST API detail](https://community.bloomreach.com/t/getting-the-document-path-hippocms-rendered-in-the-rest-api-detail/805/16):
>
> One correction: If you configure the parent mount (e.g, hst:root) of the Content HAL API mount (e.g, hst:root/api) with hst:alias [1] by setting it to site, then Content HAL API will include “site” link as well automatically like the following example: "\_links": { "self": { "href": "http://localhost:8080/site/api/documents/18e36c35-429d-4fee-b76e-eeabcbfc08bb" }, "site": { "href": "http://localhost:8080/site/events/2019/01/introduction-speech.html" } }, The installation steps [2] …

You need to get hold of HST request, so, you’ll need to call some REST service which will handle this for you.

---

<div class="post-metadata">

**Author:** ![Rahul\_Raj](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/rahul_raj/32/329_2.png) [@Rahul\_Raj](https://community.bloomreach.com/u/Rahul_Raj)\
**Post date:** [February 27, 2019, 10:00am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/6 "2019-02-27T10:00:09Z")

</div>

Thanks Machak.

I can get this working in case of document publish, where I can get UUID and path of the document published. But can you suggest me how do can I get the url(sitemap) of page being published through channel-manager? For event category “channel-manager” and event action “publishMount”.

---

<div class="post-metadata">

**Author:** ![machak](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/machak/32/1298_2.png) [@machak](https://community.bloomreach.com/u/machak)\
**Post date:** [February 27, 2019, 10:30am UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/7 "2019-02-27T10:30:35Z")

</div>

You can use HstLinkCreator for that too, see create methods which take path (string) as an argument

> **[api/src/main/java/org/hippoecm/hst/core/linking/HstLinkCreator.java · hst-5.6.0...](https://code.onehippo.org/cms-community/hippo-site-toolkit/blob/hst-5.6.0/api/src/main/java/org/hippoecm/hst/core/linking/HstLinkCreator.java)**
>
> Hippo Site Toolkit. Jira key: HSTTWO

---

<div class="post-metadata">

**Author:** ![Rahul\_Raj](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/rahul_raj/32/329_2.png) [@Rahul\_Raj](https://community.bloomreach.com/u/Rahul_Raj)\
**Post date:** [February 27, 2019, 12:25pm UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/8 "2019-02-27T12:25:08Z")

</div>

But this event does not gives me the path of the page which has been published. Can you please tell me how do i get the path from the event?

Thanks  
Rahul

---

<div class="post-metadata">

**Author:** ![machak](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/machak/32/1298_2.png) [@machak](https://community.bloomreach.com/u/machak)\
**Post date:** [February 27, 2019, 12:44pm UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/9 "2019-02-27T12:44:00Z")

</div>

you have UUID of the document, so you can get the (JCR) Node, use methods which create URL based on that, also listed in HstLinkCreator

---

<div class="post-metadata">

**Author:** ![Rahul\_Raj](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/rahul_raj/32/329_2.png) [@Rahul\_Raj](https://community.bloomreach.com/u/Rahul_Raj)\
**Post date:** [February 27, 2019, 2:32pm UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/10 "2019-02-27T14:32:46Z")

</div>

I am not talking here about document publish. I am talking about page publish through channel manager.

Thanks  
Rahul

---

<div class="post-metadata">

**Author:** ![bcanvural](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/bcanvural/32/235_2.png) [@bcanvural](https://community.bloomreach.com/u/bcanvural)\
**Post date:** [February 27, 2019, 2:59pm UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/11 "2019-02-27T14:59:26Z")

</div>

There are channel manager events on this page: [https://documentation.bloomreach.com/library/concepts/channels/overview-of-channel-manager-events-and-response-mechanisms.html](https://documentation.bloomreach.com/library/concepts/channels/overview-of-channel-manager-events-and-response-mechanisms.html)

---

<div class="post-metadata">

**Author:** ![machak](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/machak/32/1298_2.png) [@machak](https://community.bloomreach.com/u/machak)\
**Post date:** [February 27, 2019, 3:10pm UTC](https://community.bloomreach.com/t/get-pages-where-a-document-has-been-used/835/12 "2019-02-27T15:10:03Z")

</div>

> [@Rahul\_Raj](#):
>
> I am not talking here about document publish. I am talking about page publish through channel manager.

well, you are publishing the channel and a page. So, only way would be to loop through all pages on that channel, event itself has no data about changed/published pages.
