Problem with nested content and contexts


(Alderman) #1

Hi,

 

Being a Welsh University we have large amounts of content in both an English and a Welsh context.  We notice that often when nesting content in a page it will appear on the front end in one context but not the other (both ways around and after clearing matrix and squid caches).

 

The only solution seems to be repeatedly deleting and re-nesting the content until it appears in both contexts.  Anyone experienced anything similar or have any ideas?

 

Cheers,

 

Jeff.


(Anthony Barnes) #2

You may have encountered a "gotcha" with the the context system in Matrix. It may not be immediately obvious, but not all parts of the system are context-able and this includes nested content. The nest content system relies on an underlying link tree which is not context aware.

 

It's a bit difficult to explain so I'll try and give an example:

Page 1 (content available in English & Welsh)
  - Nest content (Page 2)

Page 2 - English
Page 3 - Welsh

Assume in the example above that you have a page where you change the context and try to nest in a different asset based on the context of the page you are nested other assets within. This example won't work because you can only nest an asset once which affects all contexts. There is a work around for this which involves using the keyword %globals_asset_contents_raw:[assetid]% in the content. This acts like nest content, but because it resides in the body content (either wysiwyg or raw html content div) of the page it is contextable.

Page 1 (content available in English & Welsh)
  - Nest content (Page 2)

Page 2 - (content available English & Welsh)

The above example here should work, and I'm not sure if this is what you are attempting or you are trying the first version. If you are then you may be encountering caching issues. Caching issues could be especially evident if you are displaying different context information using the same url. For language information especially you may want to consider providing your context content on different urls (e.g. domain.co.uk/en/) if you are not doing this already (our main Squiz site does this).

 

You might try the keyword style of nesting content that is context aware, although I would warn against using this too much as it's going to quickly become difficult to manage (it's good for small bits and pieces). Our Squiz site (with the exception of the polish version) uses an alternate method with paint layouts that detect the presence of the country code in the url and nests in differently configured pages. This works for us since only portions of the site need different content based on geo location, not the entire site, but it might be something you could consider if your requirements are similar.


(Alderman) #3

Hi Anthony,

 

Thanks for the detailed reply.  Our situation is the same as your second example where page 1 is available in English and Welsh and so is page 2 (which is nested into page 1).  We just need both items to respect the current context on the front end.  In fact the nested content is never a page but usually a data record with a particular set of bilingual metadata.

 

We are serving the contexts on different domains (the Welsh using /cy/ in the URL).

 

Jeff.