Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM 6.5 - Setting Default Tags

Avatar

Level 2

Note: I'm a front-end developer and not a java developer. If this needs to be handled in the backend, please let me know.

I'm working on a project that allows filterable tags. There are some tags I'd like to have populated by default, without the content creator having to find and select them. Is there a way to do that in the .context.xml dialog? Attached is my current code and what it looks like in the dialog box.

 

Use case: I have 2 tags selected. Is there a way to have them populated by default without having to click the checkbox and find them?

 

tags in xmltags in xmlcurrent tags in dialogcurrent tags in dialog

1 Accepted Solution

Avatar

Correct answer by
Level 4

Yes, you can use cq:template node in the below component to populate default values.

 

cq:template has the type nt:unstructured, it allows you to define a complex node with a set of properties and children.

It's a node you create as a child of your component definition. This content will be used as default values whenever you drop a new instance of the component from the sidekick.

 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 4

Yes, you can use cq:template node in the below component to populate default values.

 

cq:template has the type nt:unstructured, it allows you to define a complex node with a set of properties and children.

It's a node you create as a child of your component definition. This content will be used as default values whenever you drop a new instance of the component from the sidekick.

 

Avatar

Level 2
Thanks for the answer. I tried this and I added to the cq:template the name of the tags filter I'm using which you can see above I have as cq:tags (but for fun, i also tried just 'tags') and added the path of a tag as a string and I'm not seeing it populate as a default chosen tag. I made a new tag just called "test" under a global folder. The path should be "/content/cq:tags/global/" - could you by chance provide an example of the code?

Avatar

Level 1
hi sanket we are trying to do the same for a tag field under page properties which is not working as expected. Any idea on that?

Avatar

Level 4

Hi @jsolano918 ,

 

Yes, I have tested it with we-retail tags and default title component by adding one more field of "tag".

I could not attach the package here but find the below screenshot.

 

Screenshot 2021-02-02 at 11.31.42 AM.pngScreenshot 2021-02-02 at 11.31.30 AM.png