Is there a way to publish a whole tree of tags at once?
We have multiple tag trees containing a few thousand tags in AEMaaCS. How can we publish all of them at once?
I already tried it with "manage publication" while publishing a page, but this doesn't work, because process doesn't include children (even though it is enabled).
Thanks in advance,
Anian
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @webera,
You can try to use OOTB Publish Content Tree workflow.
See more under: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/repli...
Please make sure you are following the instructions form documentation, especially this part:
Do not invoke the original model. Instead, make sure to first copy the model and invoke that copy.
Hi @lukasz-m ,
unfortunately, this doesn't work. The workflow ignores the children (even tough the parameter "-includeChildren=true". The workflow only publishes the selected root tag.
Do you know a workaround for this?
Thanks!
You can create a Workflow Model that uses the Publish Content Tree process step and then trigger tree replication using this workflow:
From the AEM as a Cloud Service homepage, go to Tools - Workflow - Models.
In the Workflow Models page, press Create in the upper right corner of the screen.
Add a title and a name to your model.
Select the created model from the list, and press Edit
In the following window, drag and drop the Process Step to the current model flow
Select the Process step in the flow and select Configure by pressing the wrench icon.
Select the Process tab and select Publish Content Tree from the drop-down list, then check the Handler Advance check box
Set any additional parameters in the Arguments field. Multiple comma-separated arguments can be strung together. For example:
enableVersion=true,agentId=publish,includeChildren=true
Press Done to save the Workflow model.
Please find the below link for reference
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/operations/repli...
Hi @AMANATH_ULLAH thanks for your detailed answer! Unfortunately this doesn't work. (See Thread with @lukasz-m above)
Hi @webera ,
In Adobe Experience Manager as a Cloud Service (AEMaaCS), there isn't a built-in feature to publish entire tag trees in bulk directly from the AEM user interface. However, you can achieve this programmatically using AEM's APIs or through custom scripts.
Here's a general approach you can take:
Retrieve Tag Tree: Write a script or use AEM's APIs to retrieve the tag tree structure. You can use the TagManager API to traverse the tag tree and collect all the tags.
Publish Tags: Once you have the list of tags, you can use AEM's replication API to publish them. You can iterate over the list of tags and initiate the replication process for each tag individually.
Handle Dependencies: Keep in mind that if your tags have dependencies on other resources (like pages or assets), you may need to handle these dependencies appropriately during the publishing process.
Testing and Monitoring: Before performing bulk tag publishing in a production environment, thoroughly test your script or program in a development or staging environment to ensure it behaves as expected. Also, monitor the publishing process closely to catch any errors or unexpected behaviors.
Here's a simplified example in Java using AEM's APIs:
import com.day.cq.tagging.Tag;
import com.day.cq.tagging.TagManager;
import com.day.cq.replication.ReplicationActionType;
import com.day.cq.replication.Replicator;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import java.util.Iterator;
public class TagPublisher {
private ResourceResolverFactory resolverFactory;
private Replicator replicator;
public void publishAllTags() {
ResourceResolver resolver = null;
try {
// Acquire a ResourceResolver
resolver = resolverFactory.getServiceResourceResolver(null);
// Get TagManager
TagManager tagManager = resolver.adaptTo(TagManager.class);
if (tagManager != null) {
// Get root tag
Tag rootTag = tagManager.resolve("/etc/tags");
if (rootTag != null) {
// Publish tag tree
publishTag(rootTag, replicator, resolver);
}
}
} catch (Exception e) {
// Handle exception
} finally {
if (resolver != null) {
resolver.close();
}
}
}
private void publishTag(Tag tag, Replicator replicator, ResourceResolver resolver) {
// Publish current tag
replicator.replicate(resolver, ReplicationActionType.ACTIVATE, tag.getPath());
// Recursively publish children tags
Iterator<Tag> children = tag.listChildren();
while (children.hasNext()) {
Tag childTag = children.next();
publishTag(childTag, replicator, resolver);
}
}
}
In this example, you would need to inject the ResourceResolverFactory and Replicator dependencies into your class. Additionally, ensure that the service user associated with the ResourceResolverFactory has the necessary permissions to perform replication actions.
Before running this code in a production environment, thoroughly test it and adapt it to your specific requirements. Also, consider error handling and logging to capture any issues that may arise during the publishing process.
create package of /content/cq:tags/<parent> and replicate the package
Thanks for your answer! Unfortunately, we can't use this approach, because we have some additional logic which hooks into the publish event, which we don't have if we publish the whole package at once.
Option-1: Create package and replicate package
Disadvantage the replication status of tags might not be in sync.
Option-2: Publish content tree workflow. It works for few content types. Will have to validate for tags.
Option-3:
It should work, but Adobe would recommend Option-2( if that works)
1. Visit publish Replication agent (Tools > Deployment > Distribution > publish)
2. Click on Distribute Tab
3. Select Add Node and provide path to parent tag.
4. Submit
Hi @aanchal-sikka ,
thanks for your Answer! Unfortunately Option 1 and 2 don't work for us (see the other answers). Option 3 does not work, because we I didn't find a way to replicate a whole tree inside the Cloud Environments (it only works for single Nodes)
@webera Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Helpful - yes! But unfortunately nothing that works for us that doesn't include writing custom implementations. I would expect, that AEM can do this out of the box - especially because there are multiple ways which should work, but don't respect the "include children" options for Tags.
Views
Likes
Replies