Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Shared block over multiple pages.

Vote:
 

Hi

I am having trouble finding out whether it is possible to create a ContentArea, which content is shared by all pages, which inherit current ContentArea property.

For example if I choose to change the content of such ContentArea (ie. add some banner to it), then the changes are immediately shown on all other 
pages, which inherit such ContentArea (now all those pages have the same banner). 


And there's also another problem. When I currently change any page, I need to publish them manually, could it be made automatically when I change previously 
described ContentArea.

I hope I was clear enough. If not, please ask.

Best regards,
A

Using Episerver 9

#162130
Oct 11, 2016 14:39
Vote:
 

The content area itself can't be really inherited in that way. You can't inherit content really. You inherit between page types.

If you have tree structure with:

-Page A (with contentarea property)

---Page B (with contentarea property)

and want the same content in the content area property. 

A few options are:

1. Use fetch-data-from functionality as an editor in Episerver and point Page B to Page A and leave the contentarea in Page B empty. Then it should fetch whatever blocks are present in Page A. Probably not the best solution for a content area but pretty common when reusing content otherwise...

2. Create a block that contains other banner blocks. Add that block to both Page A and Page B when you create them. Since shared blocks are...well shared...if you change banners in the block it will be reflected on both pages. You can of course setup so that that content area, by default, has this block. Pretty decent option that solves the problem without to much custom custom...
If you don't like blocks in blocks, like me, you can use a block that contains a LinkItemCollection that contains the other blocks for instance...

3. Add logic to controller and view instead so that if the content area of Page B is empty, then it should use the content items of Page A instead. I would add this to a separate property in a custom view model and add some custom rendering for it.

Automatic publishing. I would probably skip adding that part. Sound a bit too dangerous if you make mistakes :)  

#162150
Oct 11, 2016 16:03
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.