summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-07-30 11:01:07 +0800
committerWu Cheng-Han2016-07-30 11:01:07 +0800
commit0f4f270193261bf9d0e8fd8729b2d863a35ee5f0 (patch)
tree81bef3a6a9a2152c68191c283d7d60d1b4b6d5f6
parent246c9da5742041bf7255f5c03a99448995db65a0 (diff)
Fix yaml metadata title should pass to generateWebTitle
-rw-r--r--lib/response.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/response.js b/lib/response.js
index 2fc5d58d..1a6d1137 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -108,7 +108,7 @@ function responseHackMD(res, note) {
//na
}
var title = models.Note.decodeTitle(note.title);
- title = models.Note.generateWebTitle(title);
+ title = models.Note.generateWebTitle(meta.title || title);
var template = config.hackmdpath;
var options = {
cache: !config.debug,
@@ -117,7 +117,7 @@ function responseHackMD(res, note) {
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
var html = compiled({
url: config.serverurl,
- title: meta.title || title,
+ title: title,
useCDN: config.usecdn,
facebook: config.facebook,
twitter: config.twitter,
@@ -225,10 +225,10 @@ function showPublishNote(req, res, next) {
var updatetime = note.lastchangeAt;
var text = S(body).escapeHTML().s;
var title = models.Note.decodeTitle(note.title);
- title = models.Note.generateWebTitle(title);
+ title = models.Note.generateWebTitle(meta.title || title);
var origin = config.serverurl;
var data = {
- title: meta.title || title,
+ title: title,
description: meta.description,
viewcount: note.viewcount,
createtime: createtime,
@@ -537,6 +537,7 @@ function showPublishSlide(req, res, next) {
return response.errorNotFound(res);
}
var body = LZString.decompressFromBase64(note.content);
+ var meta = null;
try {
var obj = metaMarked(body);
body = obj.markdown;
@@ -546,12 +547,12 @@ function showPublishSlide(req, res, next) {
}
var text = S(body).escapeHTML().s;
var title = models.Note.decodeTitle(note.title);
- title = models.Note.generateWebTitle(title);
+ title = models.Note.generateWebTitle(meta.title || title);
var slides = md.slidify(text, slideOptions);
var origin = config.serverurl;
var data = {
url: origin,
- title: meta.title || title,
+ title: title,
description: meta.description,
slides: slides,
GA: meta.GA,