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

文章内容含有{{会报错,无法写handlebars的代码 #880

Closed
alonprince opened this issue Oct 14, 2014 · 7 comments
Closed

文章内容含有{{会报错,无法写handlebars的代码 #880

alonprince opened this issue Oct 14, 2014 · 7 comments

Comments

@alonprince
Copy link

因为我工作中用的模板引擎是handlebars,所以在写博文的时候,会出现大量的{{Variables}},我在代码块写入这些handlebar的变量时,就会一直报错,严重影响了我的写作体验,望早日解决,谢谢。
代码如下:

<head>
  <title>admin</title>
</head>
<body>
  {{> hello}}
</body>
<template name="hello">
  <h1>Hello World!</h1>
  {{> loginButtons}}
  {{greeting}}
  <input type="button" value="Click" />
</template>
@Xuanwo
Copy link
Contributor

Xuanwo commented Oct 14, 2014

参见http://hexo.io/docs/troubleshooting.html

Hexo uses Swig to render posts. Contents wrapped with {{ }} or {% %} will be parsed and may cause problems. You can wrap sensitive contents with raw tag plugin.

@alonprince
Copy link
Author

好的,谢谢了

@alonprince
Copy link
Author

您好,我试了一下,发现还是报错,您看我写的对么?

{% rawblock %}
<head>
  <title>admin</title>
</head>
<body>
  {{> hello}}
</body>
<template name="hello">
  <h1>Hello World!</h1>
  {{greeting}}
  {{> loginButtons}}
  <input type="button" value="Click" />
</template>
{% endrawblock /%}

@tommy351
Copy link
Member

Use {% raw %}{% endraw %}

@alonprince
Copy link
Author

thanks

@gshmu
Copy link

gshmu commented Oct 22, 2014

Mark {% raw %}{% endraw %}
@alonprince 自觉Close issue

@alonprince
Copy link
Author

不好意思,忘了点了

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

4 participants