Sitecore page components aren't versioned with page

293 views Asked by At

For a website we're working on, we had a pretty complex design to support. So, we chose the strategy where all content on each page is made up of components. Authors can insert various components such as a heading, rich text block, images, etc, allowing them flexibility in laying out pages. This was the only away we could support the complex design that was created.

This set up is working well except when it comes to versioning and search. When pages are versioned, the components on the page are not. When items are indexed for search, the components on the pages are not being indexed as part of the page. We think we may be able to solve the search issue with a custom search index, but the versioning issue seems much more complex.

Has anyone else faced these issues or have thoughts on solutions? We're on Sitecore 7.5.

1

There are 1 answers

5
Richard Seal On

A simple answer would be to upgrade to version 8 as soon as its released as version 8 will add versioning to the renderings field.

My Guess is that you are setting the content of the fields on the rendering parameters of each item? If that is the case I would suggest taking a slightly different approach. Use DataSources. You could have a few templates that hold the data, e.g. RichTextTemplate, SingleLineTextTemplate, ImageTemplate - all with a single field in, then when you add a heading or rich text block to the page, setup the rendering to all the editor to create the data source.

This way all the content can be versioned properly and you are still separating your content and presentation.

To keep the tree un-cluttered, we use an "Assets" folder under the item for all content:

Example Tree:

  • Sitecore
    • Content
      • Home
      • Assets
      • Page 1
        • Assets
          • Heading
          • Rich Text Block
      • Page 2
        • Assets
          • Heading
          • Rich Text Block
          • Image Block etc...

The search problem sounds similar to this post: How to index sub-content in Sitecore with Lucene?

That suggests a computed field. In your computed field, check that your template is a page and then get all the renderings for that page. Once you have those, get the renderings DataSource items and you can build a big search field using the content from the DataSource item's fields.

This would save having an extra index with a custom access layer. It all stays within the Sitecore API.