master
branch with the following error看到这封邮件,一脸懵逼,本地运行 gitbook
服务是正常渲染的,控制台并无任何报错,谁知道推送到 github
时就报错了!css
登陆到 github
网站查看网站源码已经同步过来了,可是静态网站没法同步,本地实在找不到任何报错信息,这让我如何是好?html
再看 github
反馈用的邮件中说道,若有问题能够回复邮件(If you have any questions you can contact us by replying to this email.).git
而后死马当活马医,尝试阐释了个人问题,请求帮助定位错误日志,没想到当天下午就收到 github
的回复邮件,提供了解决办法!github
问题是因为 Liquid Warning: Liquid syntax error (line 334)
错误,然而我肯定这部分代码是没有任何问题的,由于这是我改造 gitbook-plugin-tbfed-pagefooter
插件时的一段代码,反复确认后发现并无复制粘贴出错啊!工具
var moment = require('moment'); module.exports = { book: { assets: './assets', css: [ 'footer.css' ], }, hooks: { 'page:before': function(page) { var _label = '最后更新时间: ', _format = 'YYYY-MM-DD', _copy = 'powered by snowdreams1006' if(this.options.pluginsConfig['tbfed-pagefooter']) { _label = this.options.pluginsConfig['tbfed-pagefooter']['modify_label'] || _label; _format = this.options.pluginsConfig['tbfed-pagefooter']['modify_format'] || _format; var _c = this.options.pluginsConfig['tbfed-pagefooter']['copyright']; _copy = _c ? _c + ' all right reserved,' + _copy : _copy; } var _copy = '<span class="copyright">'+_copy+'</span>'; var str = ' \n\n<footer class="page-footer">' + _copy + '<span class="footer-modification">' + _label + '\n{{file.mtime | date("' + _format + '")}}\n</span></footer>'; str += '\n\n<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">'+ '\n\n<script src="https://unpkg.com/gitalk@latest/dist/gitalk.min.js"></script>'+ '\n\n<div id="gitalk-container"></div>'+ '\n\n<script src="https://snowdreams1006.github.io/gitalk-config.js"></script>'; page.content = page.content + str; return page; } }, filters: { date: function(d, format) { return moment(d).format(format) } } };
来源于gitbook-plugin-tbfed-pagefooter
插件的index.js
文件,这里为了兼容gitalk
插件而集成了相关代码,详情请参考 gitalk 评论插件
根据邮件回复,定位到出错代码片断,真的没发现有什么问题啊?网站
既然已经肯定不是个人问题,那极可能就是 github
的问题了,邮件中推荐我使用 Jekyll
进行构建网站,不不不!ui
既然已经选择 gitbook
搭建静态网站,那就不必再使用 Jekyll
,我可不想那么麻烦!this
If you are not using Jekyll you can disable it by including a .nojekyll file in the root of your repository.
因此我不妨试试新增 .nojekyll
文件,说不定就好使了呢!spa
$ touch .nojekyll $ git add .nojekyll $ git commit -m "add .nojekyll" $ git push
天不负我!居然真的好使了,再也没有收到 github
的报错邮件反馈了,源码和网站都正常更新了!插件
据我推测,多是 github
误认为个人网站是使用 Jekyll
工具构建的,实际上,是使用 gitbook
构建的!
所以,增长 .nojekyll
文件禁用 Jekyll
工具,天然不会再受相关语法限制而报错了.
因此,遇到问题时,不只要多思考,更应该寻求官方人员的帮助,即便不回你,你也要尝试一下!