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

Noparse not rendering Antlers markup #2254

Closed
davidwarrington opened this issue Aug 19, 2020 · 3 comments
Closed

Noparse not rendering Antlers markup #2254

davidwarrington opened this issue Aug 19, 2020 · 3 comments

Comments

@davidwarrington
Copy link

Bug Description

I'm trying to use {{ noparse }} tags to create a template element that my JS can reuse as needed.

Using <h2>{{ title }}</h2> and nothing else works exactly as expected, rendering the page title.

<h2>@{{ title }}</h2> and <h2>{{ noparse }}title{{ /noparse }}</h2> leave <h2></h2> in the rendered HTML source.

How to Reproduce

  1. Create an antlers template that renders a variable, like so. Where "title" is any available variable for the template you're testing on
    <h2>{{ title }}</h2>
    <h2>@{{ title }}</h2>
    <h2>{{ noparse }}{{ title }}{{ /noparse }}</h2>
    <h2>{{ noparse }}test-{{ title }}{{ /noparse }}</h2>
    
  2. Inspect source on the template, you should find that the 2nd and 3rd h2 elements are both empty, and that the last just contains test-.

Environment

Statamic version: 3.0.0-beta.46

PHP version: 7.4

Install method (choose one):

  • Fresh install from statamic/statamic
@jasonvarga
Copy link
Member

Are you using your browser's devtools to inspect the html? Or are you using the "view source" option.

Make sure to use "view source" to see how it looks before JavaScript has a chance to mess with it.

If you're using something like Vue and have {{ something }} in your code that evaluates to null, it'll disappear.

@riasvdv
Copy link
Contributor

riasvdv commented Aug 20, 2020

Seems related to #2161

@davidwarrington
Copy link
Author

@jasonvarga After revisiting the job today, I've been unable to replicate this issue. I'm guessing I'd made a mistake, fixed it as part of something else and just not realised. Closing this issue now.

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