Add media redirect for homepage and post lists

This commit is contained in:
Hippo 2019-10-17 12:49:07 +05:30
parent 80ab94b373
commit 4cb47b02ab

View file

@ -4,6 +4,8 @@ import { Link } from 'gatsby'
import { Tags } from '@tryghost/helpers-gatsby'
import { readingTime as readingTimeHelper } from '@tryghost/helpers'
import config from '../../utils/siteConfig'
const PostCard = ({ post, isLarge }) => {
const url = `/${post.slug}/`
const readingTime = readingTimeHelper(post)
@ -13,7 +15,9 @@ const PostCard = ({ post, isLarge }) => {
<header className="post-card-header">
{post.feature_image &&
<div className="post-card-image" style={{
backgroundImage: `url(${post.feature_image})` ,
backgroundImage: `url(${post.feature_image
? post.feature_image.replace(new RegExp(config.mediaUrlFrom, 'g'), config.mediaUrlTo)
: null})`,
}}></div>}
</header>
<div className="post-card-content">