fix: post images
This commit is contained in:
parent
6004eae584
commit
401ed70d37
3 changed files with 9 additions and 11 deletions
|
@ -15,11 +15,8 @@ module.exports = {
|
|||
mdToHtml: (content) => {
|
||||
return marked.parse(content)
|
||||
},
|
||||
getPostImage: (post) => {
|
||||
if (post && post['image'] && post['image'] !== '') {
|
||||
return post['image']
|
||||
}
|
||||
|
||||
getPostImage: (image) => {
|
||||
if (image && image !== '') return image
|
||||
return '/assets/img/social-card.png'
|
||||
},
|
||||
webmentionsByUrl: (webmentions, url) => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%- capture fullUrl %}{{ site.url }}{{ page.url }}{% endcapture -%}
|
||||
<!doctype html>
|
||||
<!--suppress ALL -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>
|
||||
|
@ -9,13 +9,13 @@
|
|||
{{ site.title }}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name='viewport' content='width=device-width'>
|
||||
<link rel="canonical" href="{{ site.url }}{{ page.url }}" />
|
||||
<link rel="canonical" href="{{ fullUrl }}" />
|
||||
<meta property="og:title" content="{% if title %}{{ title }} • {% endif %}{{site.title}}" />
|
||||
<meta name="description" content="{% if excerpt %}{{ excerpt}}{% else %}{{ site.description }}{% endif %}" />
|
||||
<meta property="og:description" content="{% if excerpt %}{{ excerpt}}{% else %}{{ site.description }}{% endif %}" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:url" content="https://coryd.dev{{ page.url }}" />
|
||||
<meta property="og:image" content="/assets/img/social-card.png">
|
||||
<meta property="og:url" content="{{ fullUrl }}" />
|
||||
<meta property="og:image" content="{{ image | getPostImage }}">
|
||||
<meta name="theme-color" content="#a855f7" />
|
||||
<meta name="generator" content="{{ eleventy.generator }}">
|
||||
<link
|
||||
|
@ -79,7 +79,7 @@
|
|||
localStorage.theme = 'dark'
|
||||
document.documentElement.classList.add('dark')
|
||||
}
|
||||
});;
|
||||
});
|
||||
(function() {
|
||||
const pagination = document.getElementById('pagination');
|
||||
if (pagination) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const { getPostImage } = require('../../config/filters')
|
||||
const md = require('markdown-it')()
|
||||
const striptags = require('striptags')
|
||||
|
||||
|
@ -20,7 +21,7 @@ module.exports = {
|
|||
description: (data) => striptags(md.render(data.post_excerpt)),
|
||||
url: (data) => data.url,
|
||||
image: {
|
||||
src: '/assets/img/social-card.png',
|
||||
src: (data) => data.image | getPostImage,
|
||||
},
|
||||
author: {
|
||||
name: 'Cory Dransfeldt',
|
||||
|
|
Reference in a new issue