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

Using expressions within script tags #26

Open
danhalliday opened this issue Jan 31, 2018 · 3 comments
Open

Using expressions within script tags #26

danhalliday opened this issue Jan 31, 2018 · 3 comments

Comments

@danhalliday
Copy link

danhalliday commented Jan 31, 2018

Is it possible to use {{}} expressions within script tags? My use case is JSON+LD:

<script type="application/ld+json">
  {
    "@context": "http://schema.org",
    "@type": "WebSite",
    "description": "{{ site.description }}"
  }
</script>
@jescalan
Copy link
Member

jescalan commented Feb 2, 2018

Unfortunately it isn't - this is a limitation of parse5 - script tags are "text-only". Eventually I would like to fix this, but unfortunately I don't have the bandwidth right now 😢

@danhalliday
Copy link
Author

No problem, totally understand! I guess this is the same problem that hits with trying to use expressions within the title tag which seems to be parsed as text as per the spec.

@jescalan
Copy link
Member

jescalan commented Feb 4, 2018

Exactly. I'm interesting in building an alternative parser that is much looser in its requirements and faster, but I am not going to have space to work on this for a while, unfortunately. Getting htmlparser2 to work is also on my list to look into. Initially, I didn't use it because it doesn't include location information, which means error messages are brutal - however, that might have changed at this point. If you're interested in working on this, it is definitely a cool project, would be happy to help however I can!

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

No branches or pull requests

2 participants