The new Block and the trouble with the teaser

Hi there,

the new block feature is great! Thanks a lot.

Yesterday I build some separate fields for headline … teaser/intro … text … links … and so on.

Now, I use blocks! But one problem comes out of the dark:

In short previews I use Headline and teaser and after open the main article the hole text and the images are visible.

How can I resolve this with the new blocks without using the old fields headline and teaser?

Thanks for helping…

redo

I think the main article title shouldn’t be in the blocks? After all, the title is a separate entry anyway.

As regards the teaser, that depends. It can make a lot of sense to still have this as a separate field.

Alternatively, you can just fetch the first text block.

$first = $page->fieldname()->toBlocks()->filterBy('type', 'text')->first();
1 Like

Hi, thanks for the very fast reply.

it is not the title, it is a separate field headline, but you are right.

If I continue your idea, then a possible way is:

$headline = $page->blocktext()->toBlocks()->filterBy(‘type’, ‘heading’)->first();

$teasert = $page->blocktext()->toBlocks()->filterBy(‘type’, ‘text’)->first();

The only rule is: For that kind of articles you have to define a heading and the first text as teaser

… or …

I define a type “teaser” for the blocks… but if I follow my rule, than it is not necessary .

Do you think, I got it?

redo

I would either use the title or a separate field for the headline (although I don’t quite understand why you would need 2 fields (the title plus a headline field), because you cannot trust that the first heading in a blocks field is what you want as the title of the article.

A type teaser for the blocks is a bit weird, because you only want one teaser per blocks field.

In my opinion the block structure should be closed. It is a complete article with headline, text … sub headline … an so on.

You are right again, a own teaser definition is not necessary, because the first paragraph should be the teaser. It was a careless quick shot. (thanks to my brain for the creative phase :wink: )

Thanks a lot again. You helped me!

If you only do this for yourself, then this could work. Editors usually need to be forced into some structure, or they start such a block with text or the wrong headline type or whatever. So I see the blocks as longform text without title. And as I said, a teaser could still be a separate field for more control. But of course, it’s totally up to you how you set up your information model.

Yes, you are right. There are so many ways… Now I tested your first idea and it runs. Now, my panel is very small and I have all the information redundancy free. This is very nice.

Ok, pixelijn, thanks again and bye…