fix(views): fail-safe opengraph tag HTML rendering
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
@@ -6,9 +6,9 @@
|
|||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<%- include('../includes/favicon') %>
|
<%- include('../includes/favicon') %>
|
||||||
<% for (var og in opengraph) { %>
|
<% for (var og in opengraph) { %>
|
||||||
<% if (opengraph.hasOwnProperty(og) && String(opengraph[og]).trim() !== '') { %>
|
<% if (Object.keys(opengraph).includes(og) && typeof opengraph[og] === 'string' && opengraph[og].trim() !== '') { %>
|
||||||
<meta property="og:<%= og %>" content="<%= String(opengraph[og]) %>">
|
<meta property="og:<%= og %>" content="<%= String(opengraph[og]) %>">
|
||||||
<% }} if (!opengraph.hasOwnProperty('image')) { %>
|
<% }} if (!Object.keys(opengraph).includes('image')) { %>
|
||||||
<meta property="og:image" content="<%- serverURL %>/icons/android-chrome-512x512.png">
|
<meta property="og:image" content="<%- serverURL %>/icons/android-chrome-512x512.png">
|
||||||
<meta property="og:image:alt" content="HedgeDoc logo">
|
<meta property="og:image:alt" content="HedgeDoc logo">
|
||||||
<meta property="og:image:type" content="image/png">
|
<meta property="og:image:type" content="image/png">
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
<meta name="description" content="<%= description %>">
|
<meta name="description" content="<%= description %>">
|
||||||
<% } %>
|
<% } %>
|
||||||
<% for (var og in opengraph) { %>
|
<% for (var og in opengraph) { %>
|
||||||
<% if (opengraph.hasOwnProperty(og) && typeof opengraph[og] === 'string' && opengraph[og].trim() !== '') { %>
|
<% if (Object.keys(opengraph).includes(og) && typeof opengraph[og] === 'string' && opengraph[og].trim() !== '') { %>
|
||||||
<meta property="og:<%= og %>" content="<%= opengraph[og] %>">
|
<meta property="og:<%= og %>" content="<%= opengraph[og] %>">
|
||||||
<% }} if (!opengraph.hasOwnProperty('image')) { %>
|
<% }} if (!Object.keys(opengraph).includes('image')) { %>
|
||||||
<meta property="og:image" content="<%- serverURL %>/icons/android-chrome-512x512.png">
|
<meta property="og:image" content="<%- serverURL %>/icons/android-chrome-512x512.png">
|
||||||
<meta property="og:image:alt" content="HedgeDoc logo">
|
<meta property="og:image:alt" content="HedgeDoc logo">
|
||||||
<meta property="og:image:type" content="image/png">
|
<meta property="og:image:type" content="image/png">
|
||||||
|
|||||||
Reference in New Issue
Block a user