Hexo-Fluid主题-关于博客内容中连续写大括号会报错问题
            
              
                
                  本文最后更新于:December 3, 2021 pm
                
              
            
            
              目录
今天在写完一篇博客,使用命令 hexo g时,报了错,然后查看了一下,发现是因为博客内容中大括号的问题。所以记录一下。
先看报错内容:
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 
 | FATAL {err: Error [Nunjucks Error]: _posts/Vue/Vue基础知识-(二)基础知识.md [Line 2, Column 211] unexpected token: }}
 =====               Context Dump               =====
 === (line number probably different from source) ===
 1 | <p>Vue(读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式JavaScript框架。与其它框架不同的是,Vue被设计为可以自底向上逐层应用。Vue的核心库只关注视图层,方便与第三方库或既有项目整合。另一方面,Vue 完全有能力驱动采用单文件组件和Vue生态系统支持的库开发的复杂单页应用。Vue.js 的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件。</p>
 2 | <h1 id="目录"><a href="#目录" class="headerlink" title="目录"></a>目录</h1><h2 id="1-模板语法"><a href="#1-模板语法" class="headerlink" title="1.模板语法"></a>1.模板语法</h2><p><strong>提示:注意自行查看源代码。</strong><br>如果需要某属性值需要动态改变时,就不能再用{{}}来进行替代。即,不能这样:</p>
 3 | <!--code0-->
 4 | <p>在源代码中可以看见。其中,name和age可以正常替代,但是url是不能正常替代的。需要加上指令:<code>v-bind</code>进行数据绑定。<br>即:</p>
 5 | <!--code1-->
 6 | <p>这样在源码中可以看见,<code>href</code>的值就变成了正常的了。当然了,如果需要多个,则每个属性之前都需要加上指令进行数据绑定。如:</p>
 7 | <!--code2-->
 =====             Context Dump Ends            =====
 at formatNunjucksError (/Users/dragonone/ToTheFor/blog/node_modules/hexo/lib/extend/tag.js:171:13)
 at /Users/dragonone/ToTheFor/blog/node_modules/hexo/lib/extend/tag.js:246:36
 at tryCatcher (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/util.js:16:23)
 at Promise._settlePromiseFromHandler (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/promise.js:547:31)
 at Promise._settlePromise (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/promise.js:604:18)
 at Promise._settlePromise0 (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/promise.js:649:10)
 at Promise._settlePromises (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/promise.js:725:18)
 at _drainQueueStep (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/async.js:93:12)
 at _drainQueue (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/async.js:86:9)
 at Async._drainQueues (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/async.js:102:5)
 at Immediate.Async.drainQueues [as _onImmediate] (/Users/dragonone/ToTheFor/blog/node_modules/bluebird/js/release/async.js:15:14)
 at processImmediate (internal/timers.js:464:21) {
 line: 2,
 location: '\x1B[35m_posts/Vue/Vue基础知识-(二)基础知识.md\x1B[39m [Line 2, Column 211]',
 type: 'unexpected token: }}'
 }
 } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
 
 | 
|  | 造成的原因是两个大括号连续写。如:{{}}解决办法就是用空格隔开即可:如:{ {} }
 或者是再加上转义符:如:\{ \{ \} \}
 
 | 
之后再用 hexo g即可成功。