diff options
-rw-r--r-- | lib/response.js | 13 |
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, |