feature: pass-through yaml metadata image to html meta tag

Signed-off-by: schokotets <moritzleni@gmail.com>
This commit is contained in:
schokotets 2020-06-27 15:26:08 +02:00
parent 7b148457a7
commit 2c9f73cfb2
No known key found for this signature in database
GPG Key ID: F4C197346E9850DE
3 changed files with 15 additions and 0 deletions

View File

@ -121,6 +121,7 @@ async function showPublishNote (req, res) {
const data = {
title: title,
description: meta.description || (markdown ? Note.generateDescription(markdown) : null),
image: meta.image,
viewcount: note.viewcount,
createtime: createTime,
updatetime: updateTime,

View File

@ -40,6 +40,17 @@ This option will set the note description.
description: meta description
```
image
---
This option will set the html meta tag 'image'.
> default: not set
**Example**
```yml
image: https://raw.githubusercontent.com/hackmdio/codimd/develop/public/screenshot.png
```
tags
---
This option will set the tags which prior than content tags.

View File

@ -11,6 +11,9 @@
<% if(typeof robots !== 'undefined' && robots) { %>
<meta name="robots" content="<%= robots %>">
<% } %>
<% if(typeof image !== 'undefined' && image) { %>
<meta name="image" content="<%= image %>">
<% } %>
<% if(typeof description !== 'undefined' && description) { %>
<meta name="description" content="<%= description %>">
<% } %>