Can I access specific block content from template

  • I have a collection where the fields are setup inside of a item.html template file which contains just my fields and references a block template include.

    I am setting up a special template just for use on the homepage where I'll pull out some featured items and I wish to try get a specific title from a certain block - if it exists - is this possible from within the template without going to a page level and fetching it and injecting it back in to the template?

  • Hi Mat,

    Since a block can be added multiple times, a template-only solution may not prevent cases when an editor uses the same block more than once. The each callback option can be useful here:

    In your template you can output block_field:

    1. <perch:content id="block_field" type="hidden">
  • Thanks Hussein,

    I ended up with something very similar although querying block type is a good idea, I shall implement that. Thanks as always