mirror of https://github.com/status-im/codimd.git
Fix yaml metadata title should pass to generateWebTitle
This commit is contained in:
parent
246c9da574
commit
0f4f270193
|
@ -108,7 +108,7 @@ function responseHackMD(res, note) {
|
||||||
//na
|
//na
|
||||||
}
|
}
|
||||||
var title = models.Note.decodeTitle(note.title);
|
var title = models.Note.decodeTitle(note.title);
|
||||||
title = models.Note.generateWebTitle(title);
|
title = models.Note.generateWebTitle(meta.title || title);
|
||||||
var template = config.hackmdpath;
|
var template = config.hackmdpath;
|
||||||
var options = {
|
var options = {
|
||||||
cache: !config.debug,
|
cache: !config.debug,
|
||||||
|
@ -117,7 +117,7 @@ function responseHackMD(res, note) {
|
||||||
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
|
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
|
||||||
var html = compiled({
|
var html = compiled({
|
||||||
url: config.serverurl,
|
url: config.serverurl,
|
||||||
title: meta.title || title,
|
title: title,
|
||||||
useCDN: config.usecdn,
|
useCDN: config.usecdn,
|
||||||
facebook: config.facebook,
|
facebook: config.facebook,
|
||||||
twitter: config.twitter,
|
twitter: config.twitter,
|
||||||
|
@ -225,10 +225,10 @@ function showPublishNote(req, res, next) {
|
||||||
var updatetime = note.lastchangeAt;
|
var updatetime = note.lastchangeAt;
|
||||||
var text = S(body).escapeHTML().s;
|
var text = S(body).escapeHTML().s;
|
||||||
var title = models.Note.decodeTitle(note.title);
|
var title = models.Note.decodeTitle(note.title);
|
||||||
title = models.Note.generateWebTitle(title);
|
title = models.Note.generateWebTitle(meta.title || title);
|
||||||
var origin = config.serverurl;
|
var origin = config.serverurl;
|
||||||
var data = {
|
var data = {
|
||||||
title: meta.title || title,
|
title: title,
|
||||||
description: meta.description,
|
description: meta.description,
|
||||||
viewcount: note.viewcount,
|
viewcount: note.viewcount,
|
||||||
createtime: createtime,
|
createtime: createtime,
|
||||||
|
@ -537,6 +537,7 @@ function showPublishSlide(req, res, next) {
|
||||||
return response.errorNotFound(res);
|
return response.errorNotFound(res);
|
||||||
}
|
}
|
||||||
var body = LZString.decompressFromBase64(note.content);
|
var body = LZString.decompressFromBase64(note.content);
|
||||||
|
var meta = null;
|
||||||
try {
|
try {
|
||||||
var obj = metaMarked(body);
|
var obj = metaMarked(body);
|
||||||
body = obj.markdown;
|
body = obj.markdown;
|
||||||
|
@ -546,12 +547,12 @@ function showPublishSlide(req, res, next) {
|
||||||
}
|
}
|
||||||
var text = S(body).escapeHTML().s;
|
var text = S(body).escapeHTML().s;
|
||||||
var title = models.Note.decodeTitle(note.title);
|
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 slides = md.slidify(text, slideOptions);
|
||||||
var origin = config.serverurl;
|
var origin = config.serverurl;
|
||||||
var data = {
|
var data = {
|
||||||
url: origin,
|
url: origin,
|
||||||
title: meta.title || title,
|
title: title,
|
||||||
description: meta.description,
|
description: meta.description,
|
||||||
slides: slides,
|
slides: slides,
|
||||||
GA: meta.GA,
|
GA: meta.GA,
|
||||||
|
|
Loading…
Reference in New Issue