I followed the below steps to add a new tab in content finder to retrieve only article pages which are using "geometrixx-media/templates/media-article-page." template under /content/geometrixx-media
- Created a new node under /apps of type sling:Folder (/apps/wcm/extensions/contentfinder).
- Added the below 2 properties to the new node(contentfinder) extensionGroup="tabs"contentfinder & extensionType="contentfinder_extension"
- Copied one of the files (pages.js) in /libs/wcm/extensions/contentfinder to the folder /apps/wcm/extensions/contentfinder
- Renamed the aritles.js and changed "id" attribute and made the below changes to retrieve only article pages of template type "geometrixx-media/templates/media-article-page."
Script file location which I placed: /apps/wcm/extensions/contentfinder
file name: articles.js
Code:
{
"tabTip": CQ.I18n.getMessage("Articles"),
"id": "cfTab-Articles",
"iconCls": "cq-cft-tab-icon pages",
"xtype": "contentfindertab",
"ranking": 11,
"allowedPaths": [
"/content/*",
"/etc/scaffolding/*",
"/etc/workflow/packages/*"
],
"items": [
CQ.wcm.ContentFinderTab.getQueryBoxConfig({
"id": "cfTab-Articles-QueryBox",
"items": [
CQ.wcm.ContentFinderTab.getSuggestFieldConfig({"url": "/bin/wcm/contentfinder/suggestions.json/content"})
]
}),
CQ.wcm.ContentFinderTab.getResultsBoxConfig({
"itemsDDGroups": [CQ.wcm.EditBase.DD_GROUP_PAGE],
"items": {
"tpl":
'<tpl for=".">' +
'<div class="cq-cft-search-item" title="{pathEncoded}" ondblclick="CQ.wcm.ContentFinder.loadContentWindow(\'{[CQ.HTTP.encodePath(values.path)]}.html\');">' +
'<div class="cq-cft-search-thumb-top" style="background-image:url(\'{[CQ.wcm.ContentFinderTab.THUMBS_URL(values, 48, 48)]}\');"></div>' +
'<div class="cq-cft-search-text-wrapper">' +
'<div class="cq-cft-search-title">{[CQ.shared.XSS.getXSSTablePropertyValue(values, \"title\")]}</div>' +
'</div>' +
'<div class="cq-cft-search-separator"></div>' +
'</div>' +
'</tpl>',
"itemSelector": CQ.wcm.ContentFinderTab.DETAILS_ITEMSELECTOR
},
"tbar": [
CQ.wcm.ContentFinderTab.REFRESH_BUTTON
]
},{
"url": "/bin/wcm/contentfinder/page/view.json/content/geometrixx-media"
}, {
"baseParams": {
"type": "cq:Page",
"query": "\"cq:template\":\"geometrixx-media/templates/media-article-page\""
}
})
]
}
Now new tab(Articles) tab is getting added but First time only it is showing all article pages but if we click on any other tab and click on articles tab it is displaying all pages(article pages and other pages also).
First time when I clicked on Articles tab showing the below results:
If I clicked on any other tab(Documents) and clicked on Articles tab showing the below results: