mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 23:24:46 -04:00
Added customizable og-metadata to notes
Signed-off-by: Erik Michelson <erik@liltv.de>
This commit is contained in:
parent
116bd7230c
commit
2881f8211a
4 changed files with 23 additions and 2 deletions
|
@ -409,9 +409,18 @@ module.exports = function (sequelize, DataTypes) {
|
|||
if (meta.GA && (typeof meta.GA === 'string' || typeof meta.GA === 'number')) { _meta.GA = meta.GA }
|
||||
if (meta.disqus && (typeof meta.disqus === 'string' || typeof meta.disqus === 'number')) { _meta.disqus = meta.disqus }
|
||||
if (meta.slideOptions && (typeof meta.slideOptions === 'object')) { _meta.slideOptions = meta.slideOptions }
|
||||
if (meta.opengraph && (typeof meta.opengraph === 'object')) { _meta.opengraph = meta.opengraph }
|
||||
}
|
||||
return _meta
|
||||
}
|
||||
Note.parseOpengraph = function (meta, title) {
|
||||
var _ogdata = {}
|
||||
if (meta.opengraph) { _ogdata = meta.opengraph }
|
||||
if (!(_ogdata.title && (typeof _ogdata.title === 'string' || typeof _ogdata.title === 'number'))) { _ogdata.title = title }
|
||||
if (!(_ogdata.description && (typeof _ogdata.description === 'string' || typeof _ogdata.description === 'number'))) { _ogdata.description = meta.description || '' }
|
||||
if (!(_ogdata.type && (typeof _ogdata.type === 'string'))) { _ogdata.type = 'website' }
|
||||
return _ogdata
|
||||
}
|
||||
Note.updateAuthorshipByOperation = function (operation, userId, authorships) {
|
||||
var index = 0
|
||||
var timestamp = Date.now()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue