|
|
@ -12,6 +12,7 @@ class OpenGraph {
|
|
|
|
size;
|
|
|
|
size;
|
|
|
|
|
|
|
|
|
|
|
|
title = '';
|
|
|
|
title = '';
|
|
|
|
|
|
|
|
description = '';
|
|
|
|
author = '';
|
|
|
|
author = '';
|
|
|
|
color = '';
|
|
|
|
color = '';
|
|
|
|
showSize = false;
|
|
|
|
showSize = false;
|
|
|
@ -31,6 +32,11 @@ class OpenGraph {
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setDescription(description) {
|
|
|
|
|
|
|
|
this.description = description;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setAuthor(author) {
|
|
|
|
setAuthor(author) {
|
|
|
|
this.author = author;
|
|
|
|
this.author = author;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
@ -60,12 +66,11 @@ class OpenGraph {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
view.title = (this.title.length != 0) ? `<meta property="og:title" content="${this.title}">` : '';
|
|
|
|
view.title = (this.title.length != 0) ? `<meta property="og:title" content="${this.title}">` : '';
|
|
|
|
|
|
|
|
view.description = (this.description.length != 0) ? `<meta property="og:description" content="${this.description}">` : '';
|
|
|
|
view.site = (this.author.length != 0) ? `<meta property="og:site_name" content="${this.author}">` : '';
|
|
|
|
view.site = (this.author.length != 0) ? `<meta property="og:site_name" content="${this.author}">` : '';
|
|
|
|
view.color = (this.color.length != 0) ? `<meta name="theme-color" content="${this.color}">` : '';
|
|
|
|
view.color = (this.color.length != 0) ? `<meta name="theme-color" content="${this.color}">` : '';
|
|
|
|
view.card = !this.type.includes('video') ? `<meta name="twitter:card" content="summary_large_image">` : '';
|
|
|
|
view.card = !this.type.includes('video') ? `<meta name="twitter:card" content="summary_large_image">` : '';
|
|
|
|
|
|
|
|
|
|
|
|
//todo: og:description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Mustache.render(html, view);
|
|
|
|
return Mustache.render(html, view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -77,6 +82,7 @@ const html = `
|
|
|
|
<meta property="og:type" content="{{{ogtype}}}">
|
|
|
|
<meta property="og:type" content="{{{ogtype}}}">
|
|
|
|
<meta property="og:{{{type}}}" content="{{{http}}}{{{domain}}}/{{{resourceId}}}{{{ext}}}">
|
|
|
|
<meta property="og:{{{type}}}" content="{{{http}}}{{{domain}}}/{{{resourceId}}}{{{ext}}}">
|
|
|
|
{{{title}}}
|
|
|
|
{{{title}}}
|
|
|
|
|
|
|
|
{{{description}}}
|
|
|
|
{{{site}}}
|
|
|
|
{{{site}}}
|
|
|
|
{{{color}}}
|
|
|
|
{{{color}}}
|
|
|
|
{{{card}}}
|
|
|
|
{{{card}}}
|
|
|
|