Our organization has a lot of reusable content where it makes sense for us to shift our content strategy to compose our pages with content fragments and experience fragments. Tagging looks like it is going to be an issue though because the tags on a CF or an XF won't get automatically added to the final pages the content shows up. In fact, it looks like authors may need to tag the content multiple times at the CF, XF and page level.
Has anyone else encountered this problem and found a way to solve it?
Ideally, tags will be added at the page level as an author who creates a page would know what will that page contains and/or cater and hence any content like CF, XF or assets which gets added into the page will not bring its respective tags.
However, if you index those assets as a searchable content, then those respective tags will be used.
So, for your usecase, advised is to maintain the tags at the page level as the content can/may vary or you should also be able to customize the OOB Content fragment container component to pull the tags aswell when a CF/XF are added.
Jason - sorry for the late response here.
Applying page tags occurs typically at the page level for page tags. See this documentation here: Using Tags
You can use tags in assets too - such as a Content fragment - as discussed here: Working with Content Fragments
For example - we can add a tag here to this fragment:
See we are adding a tag here:
Notice that we added a Hiking tag to the fragment
Tags applied to an Asset - ie - a Content Fragment are used to search in Asset finder: http://localhost:4502/aem/search.html
Notice the fragment to which the tag is applied is showing up.
Content Fragments or experience fragments are like HTL or JSP components and can be added to an AEM page.
But you are correct - adding a content fragment to a page does not apply that given tag to the page. You still need to apply page tags as discussed in the Using Tags doc topic.
Assume we want to add tags to this page: http://localhost:4502/editor.html/content/we-retail/us/en/men.html
You apply a tag using the page property dialog:
AFter you select the given tags - you will notice them as shown here:
So you still need to apply tags to a page.
To sum up - tags for assets and tags for pages are different and serve different purposes.
Hope this helps...
Thanks for those answers, they do reflect my understanding of how tags have worked in AEM over the years. What's changed though is the introduction of CFs and XFs which now allow content authors to reuse an article across multiple AEM websites, multiple non-AEM websites (when AEM is used as a hybrid/headless CMS) and mobile apps.
I have noticed that if you call the HTML of an XF (point your browser to the publisher location of an XF) that you do get a fully formed HTML page with all of the XFs cq:tags stuffed into the meta keywords in the header. That's nice because if you have another app or non-AEM site leveraging the XF, the cq:tags are all available for consumption.
It seems like we're not so lucky with an AEM sites page. In our case we might have an article with 5-10 tags applied to it that would be relevant on any page using that article. XFs are intended for reuse. It's quite cumbersome for an author to have to retag that article each time it gets reused. Maybe there would be times when a tag wouldn't apply on a particular resultant page, but that's the outlier and not the norm.