Blot

Escaping template variables in posts?

I am writing a post to share some setting, seems the variables will be disappeared if there is a conflict of template. Here's what I have on iA Writer and this is what it looks like after rendering by Blot.

Asked 4 years ago Edit
5 replies

I think they need to be escaped. I'd first try '{{ PAGE_ID}}' to see if it works.

4 years ago Edit

Yes, so do I, but I cannot find the way to escape as I have tried ' but didn’t work.

4 years ago Edit

Does escaping like this work? \{{ PAGE_ID}}. I think this is because Blot uses Mustache to render templates

4 years ago Edit

Thanks! I’ve tried the pattern by using \ at the beginning but it didn’t work.

4 years ago Edit

Not sure whether this is still important to someone, but you can work around this problem by temporarily changing around the Moustache delimiter:

{{=<% %>=}}{{{avatar_url}}}<%={{ }}=%>

This will render as:

{{{avatar_url}}}

Other than that, there seems to be no possiblity to escape Moustach code.

3 years ago Edit

Your reply