文章xml添加markdown内容

This commit is contained in:
结发受长生 2020-01-16 13:29:07 +08:00
parent a1e7c3dc07
commit 79bdef1e9d
3 changed files with 2 additions and 3 deletions

View File

@ -2,7 +2,7 @@ const nunjucks = require('nunjucks')
const path = require('path')
const fs = require('fs')
const env = new nunjucks.Environment()
const env = new nunjucks.configure({ autoescape: false })
env.addFilter('noControlChars', function(str) {
return str && str.replace(/[\x00-\x1F\x7F]/g, '')
})

View File

@ -30,9 +30,7 @@ search:
<link href="/文章URL地址/"/>
<url>/文章URL地址/</url>
<content type="html">
<![CDATA[
<p>这里是文章内容</p>
]]>
</content>
<categories>
<category>分类1</category>

View File

@ -23,6 +23,7 @@
{% if post.date %}
<date>{{ +post.date }}</date>
{% endif %}
<md type="html"><![CDATA[{{post._content}}]]></md>
<content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content>
</entry>
{% endif %}