Thread tagged as: Problem, Runway

Blocks not working within related tag

Are blocks not processed withing perch:related tags?

I have two collections - 'Display Board Slides', which contains related tags for 'Display Board Widgets'.

The code for Display Board Slides is:

<li class="orbit-slide" id="slide-<perch:content id="perch_item_index" type="hidden" />">
     <div class="row align-stretch bg-white-transparent">
       <perch:related id="top-widgets" collection="Display Board Widgets" label="Header Widgets">
       <div id="<perch:content id="slug" />" class="small-12 medium-<perch:content id="size" /> columns panel">
       <perch:blocks scope-parent="true">
       <perch:template path="content/_board_blocks.html" />

_board_blocks.html contains several types of blocks.

There are two issues:

1 The HTML doesn't output the contents of the related blocks:

<div class="row align-stretch bg-white-transparent">       
       <div id="this-week-is" class="small-12 medium-4 columns panel">       
       <div id="thought-for-fortnight" class="small-12 medium-8 columns panel">       

2 The + blocks feature is shown on the edit page for 'Display Board Slides' collection, when it shouldn't be, as the blocks are within the related tag.

R T Partridge

R T Partridge 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There's currently a display bug with blocks in related items. But generally, no, you wouldn't expect those to function as part of a relationship.

Blocks have become an integral part of the way I (and others) build content; can you tell me why

you wouldn't expect those to function as part of a relationship. ?

That's going to cause a major rebuild of this section. Is there a workaround, such as loading the relationship with the each parameter?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Blocks are a good way of adding free-form display content (here's an image, here's some text...) but they're optional and unpredictable. The core fields that form the schema of your content element shouldn't be in blocks. You can't form a relationship with "maybe an image".

When you display your related item, sure, you can display it in any way you like with the blocks and whatnot. For forming a content relationship, stick to core fields.