seo-pro
seo-pro copied to clipboard
Error in Documentation or Bug with Antlers Code as Description
In the seo pro docs, there is an example for antlers templating:
{{ content | strip_tags | truncate:250:... }}
If I use this example code or if I use the code below as description content:
{{ content | strip_tags | truncate(150, '...') }}
I get this error message:
strip_tags(): Argument #1 ($string) must be of type string, array given
Statamic Version is: 4.10.2 SEO Pro Version is: 5.2.1
This would work if your content
is a string, but my guess is you're using Bard, which stores its data in an array. In order to truncate Bard text you'd need to loop the tag, get the first text var, and truncate that.
Hi @jackmcdade , no, it's a markdown field. If I place
{{ content | strip_tags | truncate(150, '...') }}
in a template somewhere, it works without problems.
Which Antlers parser are you using? You can check in config/statamic/antlers.php
– you should be using runtime
.
it is runtime
Okay, I'm gonna have @jesseleite take a look at this, he's the SEO Pro guy and it's clear that something else is at play here 🤔
ok, thanks! 😄
Hey @sewid, I'm having reproducing this with a markdown field 🤔 Could you maybe provide a simple example site repo with the issue reproduced that we could pull down by chance?
Hey @jesseleite, I've sent you an email about two weeks ago where you can find the code. Have you seen it?