Try our conversational search powered by Generative AI!

Adding a block to several pages at once?

Vote:
 

Hello, first time posting on the forum. I am not a developer but i have admin access to the episerver CMS.

We are running a new campaign and want to add a simple image block with a link to a large number of pages (100+). We could ofcourse do it manually but i am wondering if there is an easy way to automate the process.

These pages are using the same template. In the template there is a sidebar content area where we want the block to appear. The problem is, several other pages are using the same template and we don't want the block to appear on them (so we cant add the block to the template)

Is there a way to create a block then assign this block to a given content area on a set of pages based on a rule? 

#211395
Jan 07, 2020 12:56
Vote:
 

You could do this from code if you have a way of identifying the pages that should get the block.

I would create a tool available in admin mode that has:

- One input field, where you enter the id of the block, after it is created.
- A button to start the job.

The tool would then loop through every page (assume they can be easily identified through code, either because of the page type, or their placement in the content tree). For every page the tool will check if the block is already added to the sidebar content area. If it is not already added, add the block and save the page.


The same tool could be used to remove the block, when the campaign is over.

#211397
Edited, Jan 07, 2020 13:07
Vote:
 

Hello, thanks for the quick reply!

That sounds like the perfect solution. The pages are all under the same content tree, and we do need to remove the block once the campaign is finished.

But i am not familiar with episerver code, and i'm not even sure how to create a tool. Is this doable for a person with no developer experience?

#211399
Jan 07, 2020 13:23
Vote:
 

The solution I proposed would be easy for someone with Episerver developer experience.

It will require writing code. If you're not a developer, I think you will have to add the block manually to every page.

#211401
Jan 07, 2020 13:26
Vote:
 

Without developer experience, as Tomas mentioned you would need to do this manually. 

I would make a global block and ddrag this same block onto every content area and publish the page 

For around 100 pages this should take no longer than 30 minutes in total 

#211402
Jan 07, 2020 13:33
Vote:
 

Ok, thanks alot for clarifying this. I guess we're doing it manually.

#211403
Jan 07, 2020 14:49
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.