Merge pull request #1546 from schokotets/develop

feature: pass-through yaml metadata image to html meta tag
This commit is contained in:
Yukai Huang 2020-07-10 10:33:55 +08:00 committed by GitHub
commit 91fb54539a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 %>">
<% } %>