Add metadata image links

This commit is contained in:
Shadowfacts 2022-06-14 10:18:11 -04:00
parent a39a938d08
commit 0400e1d611
2 changed files with 20 additions and 9 deletions

View File

@ -75,12 +75,18 @@ export function video(metadata: Metadata, name: string, attributes: object): str
`;
}
const domain = process.env.DOMAIN;
export function render(template: string, data: any, filename?: string): string {
data.require = require;
data.fancyLink = fancyLink;
data.formatDate = formatDate;
data.video = video;
return ejs.render(template, data, {
const newData = {
require,
fancyLink,
formatDate,
video,
domain,
...data,
};
return ejs.render(template, newData, {
filename
});
}

View File

@ -7,8 +7,8 @@
<title><%= metadata.title %></title>
<link rel="canonical" href="https://shadowfacts.net<%= metadata.permalink %>">
<link rel="alternate" type="application/rss+xml" title="Shadowfacts" href="https://shadowfacts.net/feed.xml">
<link rel="canonical" href="https://<%= domain %><%= metadata.permalink %>">
<link rel="alternate" type="application/rss+xml" title="Shadowfacts" href="https://<%= domain %>/feed.xml">
<link rel="icon" href="/favicon.ico">
<link rel="apple-touch-icon-precomposed" href="/favicon-152.png">
@ -25,9 +25,14 @@
<meta property="og:type" content="website" />
<meta property="og:description" content="Just my various ramblings." />
<% } %>
<meta property="og:image" content="https://shadowfacts.net/shadowfacts.png" />
<meta property="og:url" content="https://shadowfacts.net<%= metadata.permalink %>" />
<meta property="og:url" content="https://<%= domain %><%= metadata.permalink %>" />
<meta property="og:site_name" content="Shadowfacts" />
<% if (metadata.cardImagePath) { %>
<meta property="twitter:image" content="https://<%= domain %><%= metadata.cardImagePath %>">
<meta property="og:image" content="https://<%= domain %><%= metadata.cardImagePath %>">
<% } else { %>
<meta property="og:image" content="https://<%= domain %>/shadowfacts.png" />
<% } %>
<script>
(() => {