AEM 6 - Get List of Tags | Community
Skip to main content
New Participant
December 21, 2015
Solved

AEM 6 - Get List of Tags

  • December 21, 2015
  • 1 reply
  • 7087 views

I'm trying to get a list of tags available but I keep ending up with an Array of 0

Example code:

        private List<String> tagsList = new ArrayList<String>();

 

        try{
            ResourceResolver resourceResolver = getRequest().getResourceResolver();
            // Session session = resourceResolver.adaptTo(Session.class);
            TagManager tagManager = resourceResolver.adaptTo(TagManager.class);
            Resource resource = resourceResolver.getResource("/etc/tags/bmi");
            Tag[] pageTags = tagManager.getTags(resource);
 
            for(Tag tag : pageTags){
                tagsList.add(tag.getTitle());
            }
        } catch(Exception e) {
            LOG.error("Error getting tags",e);
            throw new ServletException(e);
        }

All the tags live under /etc/tags/bmi.  I'm not sure why I'm not seeing an Array of Tags being returned.

Any help is greatly appreciated.

Thanks,

-Dean

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Hi 

Please have a look at documentation for some help:-

Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/tags/building.html

//Building Tagging into an AEM Application

 

Link:- https://helpx.adobe.com/experience-manager/using/tagmanager.html

// Using of Tagmanager API

 

Link:- http://experience-aem.blogspot.in/2013/11/aem-cq-56-new-tag-tree-tab-in-sidekick.html

// To add new tags or remove tags for a page, multiple clicks are involved in openingSidekick -> Page Tab -> Page Properties -> Basic -> Tags

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

1 reply

kautuk_sahni
kautuk_sahniAccepted solution
Employee
January 5, 2016

Hi 

Please have a look at documentation for some help:-

Link:- https://docs.adobe.com/docs/en/aem/6-1/develop/tags/building.html

//Building Tagging into an AEM Application

 

Link:- https://helpx.adobe.com/experience-manager/using/tagmanager.html

// Using of Tagmanager API

 

Link:- http://experience-aem.blogspot.in/2013/11/aem-cq-56-new-tag-tree-tab-in-sidekick.html

// To add new tags or remove tags for a page, multiple clicks are involved in openingSidekick -> Page Tab -> Page Properties -> Basic -> Tags

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni