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 {
|
export function render(template: string, data: any, filename?: string): string {
|
||||||
data.require = require;
|
const newData = {
|
||||||
data.fancyLink = fancyLink;
|
require,
|
||||||
data.formatDate = formatDate;
|
fancyLink,
|
||||||
data.video = video;
|
formatDate,
|
||||||
return ejs.render(template, data, {
|
video,
|
||||||
|
domain,
|
||||||
|
...data,
|
||||||
|
};
|
||||||
|
return ejs.render(template, newData, {
|
||||||
filename
|
filename
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
<title><%= metadata.title %></title>
|
<title><%= metadata.title %></title>
|
||||||
|
|
||||||
<link rel="canonical" href="https://shadowfacts.net<%= metadata.permalink %>">
|
<link rel="canonical" href="https://<%= domain %><%= metadata.permalink %>">
|
||||||
<link rel="alternate" type="application/rss+xml" title="Shadowfacts" href="https://shadowfacts.net/feed.xml">
|
<link rel="alternate" type="application/rss+xml" title="Shadowfacts" href="https://<%= domain %>/feed.xml">
|
||||||
|
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<link rel="apple-touch-icon-precomposed" href="/favicon-152.png">
|
<link rel="apple-touch-icon-precomposed" href="/favicon-152.png">
|
||||||
|
@ -25,9 +25,14 @@
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:description" content="Just my various ramblings." />
|
<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://<%= domain %><%= metadata.permalink %>" />
|
||||||
<meta property="og:url" content="https://shadowfacts.net<%= metadata.permalink %>" />
|
|
||||||
<meta property="og:site_name" content="Shadowfacts" />
|
<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>
|
<script>
|
||||||
(() => {
|
(() => {
|
||||||
|
|
Loading…
Reference in New Issue