10

How do I configure the XPM regions in the Tridion Reference Implementation?

I figured out you need to use the @Markup.Region(Model) helper, which reads the system\mappings\regions.json file. But I can't find what Component triggers the output of the regions.json file.

2 Answers 2

7

After examination of the code I found that the regions.json file is published as a binary when the _System\Publish Settings page is published.

The Publish Mappings TBB is used to create the regions configuration based on iterating over Component Template, where regions are automatically created based to the region name between [square-brackets] in the Component Template title. If the title does not specify a region name between square brackets, the region defaults to "Main".

After publishing of the _System\Publish Settings page, the settings in the web application should be refreshed by triggering the URL /admin/refresh. In my case however this does not work, I had to brute force delete the BinaryData folder for the changes to show up.

1
  • 2
    To add to this nice explanation, the region name is initially determined from the Component Template Metadata (if available), in most cases the Title with [square-brackets] postfix is used just to give a quick identifier of what the region is, but it also acts as a fallback in case there is no Component Template Metadata. Nov 26, 2014 at 8:33
1

In case of multilingual Web Site you need to republish _System\Publish Settings page from Master Web Site publication.

The way how it is implemented in PublishMappings .NET TBB from TRI v1.0.1 that all mappings/includes added to the package only if you are publishing from Master Web Site publication.

if (IsMasterWebPublication())
{
    filesCreated.AddRange(PublishJsonData(ReadMappingsData(), coreConfigComponent, "mapping", sg, true));
    filesCreated.Add(PublishJsonData(ReadPageTemplateIncludes(), coreConfigComponent, "includes", "includes", sg));
}

I have been hitting my head against wall for many hours to finally understand what is going on.

3
  • 1
    Indeed in TRI 1.0.x some configuration (like regions) is only published globally for a multi-publication site. In the yet to be released TRI 2.x all configuration is published for all publications
    – Will Price
    Jan 30, 2015 at 10:44
  • ...sorry about your head Stan
    – Will Price
    Jan 30, 2015 at 10:45
  • No worries! It worth to be documented ;) Jan 30, 2015 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.