Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
phiw13 on Codeberg
Offline
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
phiw13 on Codeberg
Offline
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
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
phiw13 on Codeberg
Offline
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
escapetocontent.
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
phiw13 on Codeberg
Offline
Offline
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
phiw13 on Codeberg
Offline
Offline
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
phiw13 on Codeberg
Offline