我无法将这段代码插入 Hexo.md
降价页面。
<div class="container">
<h1>Works</h1>
<ul class="row-fluid block-grid-4">
{{#each model as |w index|}}
<li>
<h5>{{w.title}}</h5>
<p>Owner: {{w.owner}}</p>
<p>{{#link-to "work" w.id}}<img class="img-responsive img-rounded" src={{w.image}} alt={{w.title}}>{{/link-to}}</p>
</li>
{{/each}}
</ul>
</div>
我认为缩进 4 个空格就足够了,但我总是遇到这个错误。
INFO Hexo is running at http://0.0.0.0:4000/. Press Ctrl+C to stop.
Unhandled rejection Template render error: unexpected token: #
at Error.exports.TemplateError (/opt/www/jusfeel/node_modules/nunjucks/src/lib.js:51:19)
at Object.extend.fail (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:64:15)
at Object.extend.parsePrimary (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:947:18)
at Object.extend.parseUnary (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:882:25)
at Object.extend.parsePow (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:856:25)
at Object.extend.parseMod (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:844:25)
at Object.extend.parseFloorDiv (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:832:25)
at Object.extend.parseDiv (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:820:25)
at Object.extend.parseMul (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:808:25)
at Object.extend.parseSub (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:796:25)
at Object.extend.parseAdd (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:784:25)
at Object.extend.parseCompare (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:751:25)
at Object.extend.parseIn (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:720:23)
at Object.extend.parseNot (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:716:21)
如果我转义散列(\#
),我得到新的错误:
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: expected variable end
at Error.exports.TemplateError (/opt/www/jusfeel/node_modules/nunjucks/src/lib.js:51:19)
at Object.extend.fail (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:64:15)
at Object.extend.advanceAfterVariableEnd (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:133:18)
at Object.extend.parseNodes (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:1159:22)
at Object.extend.parseAsRoot (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:1177:42)
at Object.module.exports.parse (/opt/www/jusfeel/node_modules/nunjucks/src/parser.js:1199:18)
at Object.module.exports.compile (/opt/www/jusfeel/node_modules/nunjucks/src/compiler.js:1118:48)
at Obj.extend._compile (/opt/www/jusfeel/node_modules/nunjucks/src/environment.js:444:35)
at Obj.extend.compile (/opt/www/jusfeel/node_modules/nunjucks/src/environment.js:433:18)
at null.<anonymous> (/opt/www/jusfeel/node_modules/nunjucks/src/environment.js:378:22)
at Object.exports.withPrettyErrors (/opt/www/jusfeel/node_modules/nunjucks/src/lib.js:24:16)
at Obj.extend.render (/opt/www/jusfeel/node_modules/nunjucks/src/environment.js:374:20)
at Obj.extend.renderString (/opt/www/jusfeel/node_modules/nunjucks/src/environment.js:261:21)
at /opt/www/jusfeel/node_modules/hexo/lib/extend/tag.js:56:9
这很令人沮丧..想一想我是否想将一些代码复制并粘贴到页面中,但我必须手动修复这个..
另外,我不能使用,{% raw %}
因为我复制的代码不是原始的(>
类似的)