Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Documentation or Bug with Antlers Code as Description #287

Open
sewid opened this issue Jul 13, 2023 · 8 comments
Open

Error in Documentation or Bug with Antlers Code as Description #287

sewid opened this issue Jul 13, 2023 · 8 comments

Comments

@sewid
Copy link

sewid commented Jul 13, 2023

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

@sewid sewid changed the title Error in Documentation or Bug Error in Documentation or Bug with Antlers Code Jul 13, 2023
@sewid sewid changed the title Error in Documentation or Bug with Antlers Code Error in Documentation or Bug with Antlers Code as Description Jul 13, 2023
@jackmcdade
Copy link
Member

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.

@sewid
Copy link
Author

sewid commented Jul 13, 2023

Hi @jackmcdade , no, it's a markdown field. If I place

{{ content | strip_tags | truncate(150, '...') }}

in a template somewhere, it works without problems.

@jackmcdade
Copy link
Member

Which Antlers parser are you using? You can check in config/statamic/antlers.php – you should be using runtime.

@sewid
Copy link
Author

sewid commented Jul 13, 2023

it is runtime

@jackmcdade jackmcdade reopened this Jul 13, 2023
@jackmcdade
Copy link
Member

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 🤔

@sewid
Copy link
Author

sewid commented Jul 13, 2023

ok, thanks! 😄

@jesseleite
Copy link
Member

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?

@sewid
Copy link
Author

sewid commented Aug 16, 2023

Hey @jesseleite, I've sent you an email about two weeks ago where you can find the code. Have you seen it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants