Search the FirstSpirit Knowledge Base
Hi all,
We have a use case to get the metadata of any pageref linked in an article
We are using FS_REFERENCE for creating internal links within the article
<FS_REFERENCE name="sitestoreref" hFill="yes" imagePreview="no" sections="no" useLanguages="no">
<FILTER>
<ALLOW type="pageref"/>
<ALLOW type="pagereffolder"/>
<ALLOW type="documentgroup"/>
</FILTER>
<LANGINFOS>
<LANGINFO lang="*" label="Target"/>
<LANGINFO lang="DE" label="Ziel"/>
</LANGINFOS>
<PROJECTS>
<LOCAL name=".">
<SOURCES>
<FOLDER name="root" store="sitestore"/>
</SOURCES>
</LOCAL>
</PROJECTS>
</FS_REFERENCE>
when a pageref is linked , I try to get the metadata in the following way:
$CMS_SET(module_label, sitestoreref.getPageRef().getPage().meta("pt_moduleLabel","inherit").toString())$
In case a folder from site store is linked, how do i get to the pageref inorder to get the metadata from its page?
Hi Yamini,
your question needs a little more clarification, since a folder can contain multiple pages, it is not clear, from which page you want to extract the metadata from.
I would assume that you want to extract it from the folder's startpage. In this case, the following methods will help you find that page:
SiteStoreFolder (FirstSpirit Access-API) :
Cheers,
René
Hi Yamini,
your question needs a little more clarification, since a folder can contain multiple pages, it is not clear, from which page you want to extract the metadata from.
I would assume that you want to extract it from the folder's startpage. In this case, the following methods will help you find that page:
SiteStoreFolder (FirstSpirit Access-API) :
Cheers,
René
Hello Rene,
We are setting the metadata on a folder level in Page store, and the metadata is inherited in the pages under that folder.
In case a page ref is linked from the site store , I am easily able to access the page from the pageref to get to the metadata.
So my question here is, if a site store folder is linked how do i go to its corresponding page folder if possible
Or
How can i get to (any) page ref belonging to that folder (since we inherit the same metadata in all children pages), so that i can get the page and the metadata again.
Please let me know if I need to provide some more clarification.
Many thanks!
> if a site store folder is linked how do i go to its corresponding page folder if possible
I believe there is no "corresponding page folder", as the structures in the SiteStore and PageStore can be entirely different. Though depending on the content strategy, they are often very similar.
Imagine a site-store folder containing three pagerefs to three pages in different page-store folders. Then it would be difficult to define, which folder is the corresponding one.
But if your structure basically mimics the same structure in both stores, then just select any page (getFirstChild of type PageRef) or get the startNode from the sitestore folder. I would recommend the second one, as there is always either a startnode or no pageref at all in a folder. This relies also on the constraint, that the folder structures remain similar.
Another option might be to disallow selecting folders in your FS_Reference.
Cheers,
René