summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorSheogorath2019-10-10 14:55:34 +0200
committerGitHub2019-10-10 14:55:34 +0200
commitcd34a8c70226a094b5698ae7ab8b3bcd5ce75b41 (patch)
treee7839d0751fea4f8e5deaed9560657c6ad97f946 /public
parent3255649917569eb8f1bed02b1aed8045322736e4 (diff)
parentf26f48793fdf5bb81f4bec5d7c50e5fe1ba978d6 (diff)
Merge pull request #191 from ErikMichelson/feature/ogmetadata
Add customizable opengraph metadata for notes (see #40)
Diffstat (limited to '')
-rw-r--r--public/docs/yaml-metadata.md17
-rw-r--r--public/views/codimd/head.ejs8
-rw-r--r--public/views/index/head.ejs7
-rw-r--r--public/views/pretty.ejs8
4 files changed, 40 insertions, 0 deletions
diff --git a/public/docs/yaml-metadata.md b/public/docs/yaml-metadata.md
index 8e59c8f2..f09591bc 100644
--- a/public/docs/yaml-metadata.md
+++ b/public/docs/yaml-metadata.md
@@ -159,3 +159,20 @@ slideOptions:
transition: fade
theme: white
```
+
+opengraph
+---
+This option allows you to override the default generated opengraph metadata.
+See the [OpenGraph protocol documentation](https://ogp.me) for more information.
+
+**Notice: always use two spaces as indention in YAML metadata!**
+
+> default: not set (uses auto-generated metadata)
+
+**Example**
+```yml
+opengraph:
+ title: Special title for OpenGraph protocol
+ image: https://dummyimage.com/600x600/000/fff
+ image:type: image/png
+```
diff --git a/public/views/codimd/head.ejs b/public/views/codimd/head.ejs
index e3edde66..934767f6 100644
--- a/public/views/codimd/head.ejs
+++ b/public/views/codimd/head.ejs
@@ -4,6 +4,14 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="mobile-web-app-capable" content="yes">
+<% for (var og in opengraph) { %>
+<% if (opengraph.hasOwnProperty(og) && opengraph[og].trim() !== '') { %>
+<meta property="og:<%- og %>" content="<%- opengraph[og] %>">
+<% }} if (!opengraph.hasOwnProperty('image')) { %>
+<meta property="og:image" content="<%- serverURL %>/codimd-icon-1024.png">
+<meta property="og:image:alt" content="CodiMD logo">
+<meta property="og:image:type" content="image/png">
+<% } %>
<title><%= title %></title>
<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
diff --git a/public/views/index/head.ejs b/public/views/index/head.ejs
index d790d917..0f1e584e 100644
--- a/public/views/index/head.ejs
+++ b/public/views/index/head.ejs
@@ -6,6 +6,13 @@
<meta name="mobile-web-app-capable" content="yes">
<meta name="description" content="<%= __('Best way to write and share your knowledge in markdown.') %>">
<meta name="keywords" content="Collaborative, Markdown, Notes">
+<meta property="og:title" content="CodiMD - <%= __('Collaborative markdown notes') %>">
+<meta property="og:description" content="<%= __('Best way to write and share your knowledge in markdown.') %>">
+<meta property="og:type" content="website">
+<meta property="og:url" content="<%- serverURL %>">
+<meta property="og:image" content="<%- serverURL %>/codimd-icon-1024.png">
+<meta property="og:image:alt" content="CodiMD logo">
+<meta property="og:image:type" content="image/png">
<title>CodiMD - <%= __('Collaborative markdown notes') %></title>
<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs
index 1970ab2f..20bb44e3 100644
--- a/public/views/pretty.ejs
+++ b/public/views/pretty.ejs
@@ -14,6 +14,14 @@
<% if(typeof description !== 'undefined' && description) { %>
<meta name="description" content="<%= description %>">
<% } %>
+ <% for (var og in opengraph) { %>
+ <% if (opengraph.hasOwnProperty(og) && opengraph[og].trim() !== '') { %>
+ <meta property="og:<%= og %>" content="<%= opengraph[og] %>">
+ <% }} if (!opengraph.hasOwnProperty('image')) { %>
+ <meta property="og:image" content="<%- serverURL %>/codimd-icon-1024.png">
+ <meta property="og:image:alt" content="CodiMD logo">
+ <meta property="og:image:type" content="image/png">
+ <% } %>
<title><%= title %></title>
<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">