Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-05-15 08:40:30

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

escape=tags attribute limitation?

Are there any limitations on using the escape="tags" attribute/value pair on the <txp:meta_description / in the <head /> of a document? Like this:

<txp:meta_description escape="tags" />

When inserted that way – coupled with the format="", inside the <body /> it works fine, output is the textual content of the meta-description of a section stripped of all HTML tags. But in the <head /> the output is a blank line – no output at all.

The same is true for the description meta field of an individual article. :-)

TXP 4.8.8 with PHP 8.1.x.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2022-05-16 06:06:43

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: escape=tags attribute limitation?

Any take on this ?

I can work around the problem by listing individual tags as values for the escape attribute. That works.

<txp:meta_description escape="a,b,i,em,span,strong,trim" />

As the description field for sections only accepts 256 characters, there is not much space for adding block level tags.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2022-05-16 11:12:22

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: escape=tags attribute limitation?

phiw13 wrote #333294:

Are there any limitations on using the escape="tags" attribute/value pair on the <txp:meta_description / in the <head /> of a document?

No, not specifically in <head />, it just does not play well with the default format="meta". In this case the tag outputs something like

<meta name="description" content="Hey <i>you</i>!" />

which is then filtered via escape. Hence escape="tags" strips out <meta /> tag itself, but escape="i" works as expected. You can surely use

<meta name="description" content='<txp:meta_description format="" escape="tags" />' />

but it would probably be better to limit escape to content.

Offline

#4 2022-05-16 11:29:39

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: escape=tags attribute limitation?

Ok, thanks for explaining the limitation(s) with this particular combination. I see now that it is quite a sledge-hammer.

I find it quite useful to be able to use HTML tags or Textile in the section description field and use that as a short introduction type bit of text on list pages.

I will test out your suggestion as an alternative to my workaround. Thank you for that.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#5 2022-05-17 05:29:13

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: escape=tags attribute limitation?

etc wrote #333306:

You can surely use

<meta name="description" content='<txp:meta_description format="" escape="tags" />' />...

Yes, thanks that works perfectly

but it would probably be better to limit escape to content.

I would think so – intuitively I naively (?) expected these escape to work on the content of the description field (in the example in this thread).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2022-05-17 07:16:50

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: escape=tags attribute limitation?

phiw13 wrote #333338:

intuitively I naively (?) expected these escape to work on the content of the description field (in the example in this thread).

Looks logical, will change.

Offline

#7 2022-05-17 07:32:21

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: escape=tags attribute limitation?

Thank you!


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2022-05-17 15:16:52

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: escape=tags attribute limitation?

Should be done now, please test on dev.

Offline

#9 2022-05-18 00:34:45

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: escape=tags attribute limitation?

Great, a test on my local playground: it seems to work just fine. TY.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB