Forum
Blocks in Blog post.html template not available in post page
I have an issue with when using Blocks in the blog templates.
I have 5 blocks with id's: label="Sub Titles" label="Feature Image" label="Text" label="Images" label="Pull quote"
In the post input screen only three blocks are available to choose from: +Text +Images +Pull Quote
The Sub Tltles and feature image are missing.
I tried swapping the Sub Titles and Feature Image Blocks so that they were 4th and 5th in the blocks list and then I got
+Sub Titles +Feature Image + Pull Quote
Again only three and again in reverse order compared to in the template. But also now the content I put in for any TeXt and Image fields has disappeared from the input page. It is still there because when I reverse the code back to the original order of blocks the missing content comes back.
Why can I only get 3 of the 5 block fields to show in the content input page?
Here is the code
<h1><perch:blog id="postTitle" type="text" label="Title" required="true" size="xxl autowidth" order="1" /></h1>
<perch:blog id="excerpt" type="textarea" label="Excerpt" suppress="true" size="s autowidth" order="2" />
<perch:blocks>
<perch:block type="text" label="Sub Titles">
<h2><perch:blog id="postSubTitle" type="text" label="Sub title" size="xl autowidth" /></h2>
</perch:block>
<perch:block type="image" label="Feature Image">
<figure class="FeatureImage">
<img src="<perch:blog id="FeatureImage" type="image" label="Feature Image" />" width="100%" alt="<perch:blog id="FeatureImageCaption" type="smarttext" label="Feature Image alt text" />" />
</figure>
</perch:block>
<perch:block type="text" label="Text">
<perch:blog id="content" type="textarea" label="Text" editor="redactor" html="true" imagewidth="400" imageheight="300" />
</perch:block>
<perch:block type="image" label="Images">
<figure class="contentimage">
<img src="<perch:blog id="contentimage" type="image" label="Images" />" alt="<perch:blog id="caption" type="smarttext" label="Caption" />" />
<figcaption>
<perch:blog id="caption" type="smarttext" label="Caption" />
</figcaption>
</figure>
</perch:block>
<perch:block type="quote" label="Pull quote">
<blockquote cite="<perch:blog id="cite" type="text" label="Web address where quote is from" size="xl" />" />
“<perch:blog id="quote" type="text" label="Pull Quote" size="xl" />”<br />
<span class="quoteauthor"><perch:blog id="quoteauthor" type="text" label="Quote attributed to:" size="xl" /></span>
</blockquote>
</perch:block>
</perch:blocks>
<time class="dt-published" datetime="<perch:blog id="postDateTime" type="date" label="Date" time="true" format="Y-m-d H:i:s" divider-before="Meta information" />">
<perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" />
</time>
Blocks need a unique "type", it's an identifier for the Block.
type is an 'ID-like reference': https://docs.grabaperch.com/docs/templates/blocks/
Perfect - thanks Rachel - was looking in the wrong place as usual!
Final Code for those that have the same problem (i.e. - me later)