forked from shadowfacts/shadowfacts.net
Add metadata image links
This commit is contained in:
parent
a39a938d08
commit
0400e1d611
16
lib/util.ts
16
lib/util.ts
|
@ -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
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
(() => {
|
||||
|
|
Loading…
Reference in New Issue