Hi,
I want to rename a page, but it occurs a warning as following. How can I rename this page? Thanks!
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
I would recommend to use Sling Alias (Advanced Tab) property in the page properties instead of rename the page.
The property sling:alias set on any pages to indicate an alias name for the page. For example, /content/visitors may have the sling:alias property set to besucher allowing the page to be addressed in an URL as /content/besucher as well as the original path /content/visitors.
Thanks for your suggestion. In this case, I created a new page (using the new template ) to replace the old template page, using the same path, so I need to rename the old page to another url, failed actually. Is there any way to achieve it?Thanks.
Hi @Dorothy007
It will automatically adjust name in references.You can try on one dummy page in local instance.
alternative, can try @Mahedi_Sabuj solution as well.
Hope it helps.
Tried. After the warning, I can't proceed the next step.
Views
Replies
Total Likes
@Dorothy007 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
Thanks. I haven't found a solution yet. I tried both ways below and failed.
1. Rename the page: Warning the page has more than 150 references and cannot move to next step.
2. Delete the page: The page is deleted and disappeared from the content tree, but the page URL is still live. I cannot create or rename the new page with the URL name which I have deleted.
Do you have any recommend?Thanks in advance.
We can use a Groovy script to rename a page and find its references. Recently we did for some other purpose like DM migration
Views
Replies
Total Likes
Renaming a page with more than 150 references in Adobe AEM can be challenging due to the limitations of the default rename functionality. However, there are a couple of workarounds that can be implemented to successfully rename the page and update all its references.
Method 1: Utilizing the Touch UI
The Touch UI in Adobe AEM offers a more advanced rename feature that can handle a larger number of references. To utilize this method, follow these steps:
Access the Touch UI: Navigate to the page you want to rename and switch to the Touch UI mode.
Initiate the rename process: Right-click on the page in the content tree and select "Rename" from the context menu.
Enter the new page name: Provide the desired new name for the page.
Acknowledge the warning: A warning message will appear indicating the high number of references. Click on "Rename" to proceed.
Confirm the rename: The Touch UI will automatically update all references to the page, even if there are more than 150.
What happens when you do this?
Method 2: Use a Groovy Script
Here is an example of a Groovy script that can be used to rename a page in Adobe AEM and update all its references:
import com.day.cq.wcm.api.PageManager
import com.day.cq.wcm.api.WCMException
import org.apache.sling.api.resource.ResourceResolver
// Get the current resource resolver
def resourceResolver = scriptBindings.getResourceResolver()
// Get the PageManager instance
def pageManager = resourceResolver.adaptTo(PageManager.class)
// Get the page to be renamed
def page = pageManager.getPage("/content/my-page") // Replace "/content/my-page" with the path to the page you want to rename
// Get the new page name
def newPageName = "new-page-name" // Change "new-page-name" to the desired new name for the page
// Rename the page
page.rename(newPageName)
// Update all references to the page
def references = page.getReferences()
for (reference in references) {
def referencingPage = pageManager.getPage(reference.path)
referencingPage.getProperties().put("cq:name", newPageName)
referencingPage.update()
}
// Save the changes
page.commit()
This script will rename the page /content/my-page to a new-page-name and update all references to the page. Make sure to replace /content/my-page with the path to the page you want to rename and new-page-name with the desired new name for the page.
Additional Considerations:
Backup: Before attempting to rename the page, it's crucial to create a backup of the AEM content repository to ensure data integrity in case of any unforeseen issues.
Testing: If the Touch UI or script method is being used, it's advisable to test the renaming process on a staging environment before applying it to the production environment.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies