How to output text only with text of links and no text decoration?


I have a optional seo field and if this one is empty, the meta-description get the required presentation textarea field.

So I want to display the presentation in the head of the page, without html tags but without kirbytags too.

For example if the presentation field value is :

Some *text* and some (link: icon: text: links)

I want to output :
Some text and some links

I can’t figure how to to this

Instead of ->kirbytext() use ->html() or maybe ->value().

Can you try this:




@jimbobrjames, I did test both ->html() and ->value() but in each case I get:

Some *text* and some (link: icon: text: links)

@bvdputte, this is my solution ! It works great !

Yep, that’s it (and some more chars).

1 Like

I stand corrected. II have only ever put plain text in my SEO fields, though so I guess ive never hit that issue. It’s worth mentioning that the Meta Tags plugin can help out a great deal with this, in combination with the trick above.

Thanks anyway and I’m going to look at this Meta Tags plugin !

Just to clarify:
value() returns the value of a field as string (does not convert kirbytags etc.); this field is used when we need a string representation rather than the page object itself. Using the above example you would get the following result: Some *text* and some (link: icon: text: links)
html() converts the field value to valid html, but does not convert kirbytags, either; so this field method is generally used with fields that do not contain kirbytext/markdown. Result would be the same as above in this case.

Sure… so say you had a & in your text like Mumford & Sons in your text field, html() would convert that charcter to & but not touch any markdown/kirbytext.