[hexo]: Colons-in-blog-post-titles

這個 Blog 一直使用 hexo 這個 blog framework(Static Site Generators)

記得之前剛開始使用 hexo 的時候就會遇到一個問題

當標題出現 : [] 冒號跟括號的時候,在 hexo generate 的時候會有問題

直到在 hexo 的 GitHub Issues 中看到了

開這個 issue 的網友有遇到一樣的問題

Hexo uses directly js-yaml (after some tabulator escaping).

var yaml = require(‘js-yaml’),
escape = require(‘../../util’).escape.yaml;

module.exports = function(data){
return yaml.load(escape(data.text));
};
In my eyes, you have two choices:

a) use quotation marks, as in title: “my title : with colon” to simply escape the title. There are some more to find in the YAML specs

b) extend the js-yaml library

You wrote “He tried escaping the colon within the title, but doing so had no effect.”… hmm what exactly have you tried? For me option a) worked in a quick test. Following the specs “title: my title : with colon” should work, too, but I didn’t test this one.

sergiolepore 提到:

Use quotation marks. Take a look at this:

post.md
Rendered post