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

Antlers tag is rendered in bard code block #3631

Closed
nckrtl opened this issue Apr 9, 2021 · 9 comments · Fixed by #4257
Closed

Antlers tag is rendered in bard code block #3631

nckrtl opened this issue Apr 9, 2021 · 9 comments · Fixed by #4257

Comments

@nckrtl
Copy link

nckrtl commented Apr 9, 2021

I was writing something about SEO Pro on my blog and I noticed the {{seo_pro:meta}} tag gets rendered on the page when I have it in a code block in bard content. Other antlers tags are not being rendered, as expected.

Also a preceding @ doesn't work. Example bard content in a code block:

{{# base.antlers.html #}}

{{ if environment != 'local' }}
  {{ seo_pro:meta }} <-- gets rendered
{{ /if }}

Expected behaviour would be to not render any tag when its in a code block. Is there any way to prevent this from happening?

Thanks, Nick

@duncanmcclean
Copy link
Member

If you {{ environment | dump }}, what does it give you?

@nckrtl
Copy link
Author

nckrtl commented Apr 9, 2021

Hi Duncan, that's displaying "local" as expected. All I want is to be able to display the seo:pro tag with 2 curly brackets instead of one. Now I have to do this to not have it rendered in the frontend ( 1 { instead of {{ ):

Screenshot 2021-04-09 at 09 35 25

@duncanmcclean
Copy link
Member

Are you sure that works with a single curly brace on a non-local environment? If it does, that's new to me, never seen Antlers act like that before.

@nckrtl
Copy link
Author

nckrtl commented Apr 9, 2021

See https://nckrtl.com/articles/speedup-page-loads-when-working-with-statamic-s-seo-pro-locally

I want that snippet to be displayed in the code block in bard like:

{{# base.antlers.html #}}

{{ if environment != 'local' }}
  {{ seo_pro:meta }}
{{ /if }}

But that actually renders the seo:pro tag in the frontend which I don't want, as I have it in a code block for demonstration purposes.

So to not render the tag in the code block I used a single { instead of {{. So it's correct that that's not rendering.

@jesseleite
Copy link
Member

Can you post the output of php please support:details for us?

@nckrtl
Copy link
Author

nckrtl commented Apr 9, 2021

Statamic 3.1.5 Solo
Laravel 8.36.2
PHP 8.0.3
kind-work/meili-search 1.1.0
statamic/seo-pro 2.2.0

I have the same with PHP 7.4:

Statamic 3.1.5 Solo
Laravel 8.36.2
PHP 7.4.16
kind-work/meili-search 1.1.0
statamic/seo-pro 2.2.0

Edit: This is what my code looks like when printing the snippet

<pre class="bg-gray-950">
    <code class="font-mono prose language-twig">
        {{ twig }}
    </code>
</pre>

@jasonvarga
Copy link
Member

How are you outputting the blog post contents? Does that field have antlers: true? Disable it.

@nckrtl
Copy link
Author

nckrtl commented Apr 9, 2021

Not sure if I follow. Do I need to set that in de markdown file? Currently its looking like:

- type: set
  attrs:
      values:
          type: twig
          twig: |-
              {{# base.antlers.html #}}

              {{ if environment != 'local' }}
                {{seo_pro:meta}}
              {{ /if }}

I tried this:

- type: set
  antlers: false <-- no effect
  attrs:
      antlers: false <-- no effect
      values:
          antlers: false <-- no effect
          type: twig
          twig: |-
              {{# base.antlers.html #}}

              {{ if environment != 'local' }}
                {{seo_pro:meta}}
              {{ /if }}

I don't see an option in the bard settings of the blue print to disable antlers or anything. Neither in the specific code set.

Edit: also prepending the seo:pro tag with a @ like @{{ seo_pro:meta }} is not preventing it from rendering.

@jasonvarga
Copy link
Member

I didn't realize you said bard originally. That should be enough for us to go on. Thanks.

@jesseleite jesseleite transferred this issue from statamic/seo-pro May 3, 2021
@jesseleite jesseleite added the bug label May 3, 2021
@jesseleite jesseleite changed the title seo_pro tag is rendered in code block antlers tag is rendered in bard code block May 3, 2021
@jesseleite jesseleite changed the title antlers tag is rendered in bard code block Antlers tag is rendered in bard code block May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants