Forum

Thread tagged as: Question, Field-Types

Is it possible to test if block content is present?

I'm wondering whether it's possible to test if a user has added any 'blocks' content?

My use case is that I'd like to add 'read more' link to a list page if I know the single page has block content.

I know you can reach 'outside' the blocks' scope, but I guess I'd like to do the opposite and reach 'inside' to test for existing content.

Jay George

Jay George 2 points

  • 2 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hey Jay,

I think you can check for _blocks in the template:

<perch:if exists="_blocks">
<!--* your code *-->
</perch:if>

Brilliant. Thank you!

Yeah.... @hussein... Brilliant. Thank you!