summaryrefslogtreecommitdiff
path: root/lib/response.js
diff options
context:
space:
mode:
authorErik Michelson2019-10-04 19:49:45 +0200
committerErik Michelson2019-10-04 19:49:45 +0200
commit2881f8211aaaa2def3f3cedabf635f03733ac82e (patch)
tree4fb907585270cd710a7dcea0e1be01f2eb46fb87 /lib/response.js
parent116bd7230c91e76e1d94e8878bef6487cbcc00ea (diff)
Added customizable og-metadata to notes
Signed-off-by: Erik Michelson <erik@liltv.de>
Diffstat (limited to '')
-rw-r--r--lib/response.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/response.js b/lib/response.js
index 81d732a5..7535d266 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -98,12 +98,14 @@ function responseCodiMD (res, note) {
var meta = models.Note.parseMeta(extracted.meta)
var title = models.Note.decodeTitle(note.title)
title = models.Note.generateWebTitle(meta.title || title)
+ var opengraph = models.Note.parseOpengraph(meta, title)
res.set({
'Cache-Control': 'private', // only cache by client
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
})
res.render('codimd.ejs', {
- title: title
+ title: title,
+ opengraph: opengraph
})
}
@@ -217,6 +219,7 @@ function showPublishNote (req, res, next) {
var updatetime = note.lastchangeAt
var title = models.Note.decodeTitle(note.title)
title = models.Note.generateWebTitle(meta.title || title)
+ var ogdata = models.Note.parseOpengraph(meta, title)
var data = {
title: title,
description: meta.description || (markdown ? models.Note.generateDescription(markdown) : null),
@@ -232,7 +235,8 @@ function showPublishNote (req, res, next) {
GA: meta.GA,
disqus: meta.disqus,
cspNonce: res.locals.nonce,
- dnt: req.headers.dnt
+ dnt: req.headers.dnt,
+ opengraph: ogdata
}
return renderPublish(data, res)
}).catch(function (err) {