Thread tagged as: Question, Problem, Field-Types

Title attribute with repeated content ID in Perch blocks

I have three Perch block template variations within a Perch blocks template. Each shares a common ID for the headline and that ID is specified title="true" in each one. This isn't working (still appearing as "Item 1, Item 2, etc."). Do I have to use unique ID names for each Perch block template that is specified as title="true", or what is the error here?

Your docs tell me: Perch looks at the first tag with each ID and ignores the rest at edit time.

...but I find this a bit vague. It doesn't seem to address the problem I'm having.

The code in each block is as follows:

<perch:content id="feathead" type="textarea" label="Featured Headline" required="true" title="true" editor="markitup" markdown="true" /> 
kyle cadotte

kyle cadotte 0 points

  • 3 years ago

Hi Kyle

Are you using blocks or repeaters here? The title attribute doesn't do anything with blocks. It's used to add a title to the control panel when listing out repeaters.

Can you post the whole template?


Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't use content from blocks to form the title for the item. The title can be built up from standard fields not inside blocks.

Repeaters will work in some instances where the template area containing the intended title="" id doesn't require css variations. But not, for instance, in a news feed, the editor can choose between a template for vertical, horizontal or square imagery, all of which require different styling and therefore different html for both the image part of that template and the headline/text part. What I want is a region containing all the entries for a news feed where the editor can not only repeat the template but choose between several variations of that template. I have achieved this very nicely with Perch blocks using three block template variations.

The "item 1, item 2" directory will hopefully suffice but I wish I could add the title="" attribute here. Then it would be perfect.

Maybe you're looking for something like this.

I often use the following to give a name to blocks items. As you see, it goes before the <perch:blocks> tag and has suppress="true" so the title appears on the edit page only.

In Region Options I typically "Allow multiple items" but do not "Edit all on one page."

      <perch:content type="text" id="name_edit_item" label="Name for this item." help="Editor: This gives a name to this item in the edit area, rather than Item1, Item2, etc. It does not appear on the page." title="true" suppress="true"/>