Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

copy page

Avatar

Level 8

Hi All,

 

We've encountered a challenge regarding the utilization of a specific template. Previously, we had restricted the usage of the template exclusively to the path "/content/training(/.*)", using allowedpaths property.

Initially, we also permitted the path "/content/countrysites" within our allowed paths configuration. Consequently, certain pages were created under "/content/countrysites/en-us/aboutus".

 

However, subsequent adjustments led to the removal of "/content/countrysites" from the allowed paths. Presently, we encounter an issue wherein we intend to copy the page located at "/content/countrysites/en-us/aboutus" to "/content/countrysites/en-uk/aboutus". Regrettably, attempting to execute this operation results in an error message indicating that the template associated with the original page is not allowed under "/content/countrysites/en-uk".

 

Our objective is to copy the page from en-us to en-uk while ensuring that editors are unable to select the template for creating new pages. We seek guidance on achieving this objective within the constraints of our current configuration.

 

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi @Vani1012 , to allow copying, it's necessary we should have "/content/countrysites" in allowed paths.
To restrict editors did you try to adjust the permissions to control which templates are visible to different user groups? If editors don't have read access to the old template, they won't be able to see or use it.

Also, the other ways could be:
-- Implement a custom validation step in a workflow that is triggered upon page creation. If the page is created with a disallowed template, the workflow step can either prevent further processing or notify an admin.
-- You can create a custom Sling filter/servlet/event listener that intercept requests for page creation and validate the template being used. If it's the old template, return a forbidden response or redirect to an error page.
-- Try deactivating the Old Template. I am not sure this would work or not though.
-- Customize the create page dialog using Granite UI components and use some logic to exclude the old template.

View solution in original post

5 Replies

Avatar

Level 6

Hi @Vani1012 , did you try adding the "/content/countrysites" to the allowed paths again after the removal and then try out the copy operation?

Avatar

Level 8

Hi @kapil_rajoria Yes I tried that I am able to copy the page to en-uk but the problem is the editors are getting an option to create page under "/content/countrysites" with that article old template.

Here I want to restrict editors from creating pages using the old template while still allowing them to copy pages between different country sites.

1. From "/content/countrysites/en-us/aboutus" copy to "/content/countrysites/en-uk/aboutus"

2. From "/content/countrysites/en-us/contact" copy to "/content/countrysites/en-ca/contact"

Avatar

Correct answer by
Level 6

Hi @Vani1012 , to allow copying, it's necessary we should have "/content/countrysites" in allowed paths.
To restrict editors did you try to adjust the permissions to control which templates are visible to different user groups? If editors don't have read access to the old template, they won't be able to see or use it.

Also, the other ways could be:
-- Implement a custom validation step in a workflow that is triggered upon page creation. If the page is created with a disallowed template, the workflow step can either prevent further processing or notify an admin.
-- You can create a custom Sling filter/servlet/event listener that intercept requests for page creation and validate the template being used. If it's the old template, return a forbidden response or redirect to an error page.
-- Try deactivating the Old Template. I am not sure this would work or not though.
-- Customize the create page dialog using Granite UI components and use some logic to exclude the old template.

Avatar

Community Advisor

Hi @Vani1012 ,

It sounds like you want to copy a page from one language region (en-us) to another (en-uk) within the /content/countrysites path, while still maintaining the restriction that editors cannot select the template for creating new pages.

Since you have restricted the usage of the template exclusively to the path "/content/training(/.*)", you need to ensure that this restriction does not prevent copying the page to the new location ("/content/countrysites/en-uk/aboutus").

To achieve this objective, you can follow these steps:

  1. Temporary Template Assignment: Temporarily assign a different template (one that is allowed in /content/countrysites/en-uk) to the page at "/content/countrysites/en-us/aboutus".

  2. Copy the Page: After assigning the temporary template, attempt to copy the page from "/content/countrysites/en-us/aboutus" to "/content/countrysites/en-uk/aboutus".

  3. Restore Original Template: Once the copy is completed, revert the template assignment of the copied page back to the original template (which is restricted to /content/training(/.*)).

By following these steps, you should be able to copy the page to the new location while ensuring that editors are unable to select the template for creating new pages. This approach allows you to temporarily bypass the template restriction during the copy operation.

Avatar

Administrator

@Vani1012 Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni