Add media redirect for homepage and post lists
This commit is contained in:
parent
80ab94b373
commit
4cb47b02ab
1 changed files with 5 additions and 1 deletions
|
@ -4,6 +4,8 @@ import { Link } from 'gatsby'
|
||||||
import { Tags } from '@tryghost/helpers-gatsby'
|
import { Tags } from '@tryghost/helpers-gatsby'
|
||||||
import { readingTime as readingTimeHelper } from '@tryghost/helpers'
|
import { readingTime as readingTimeHelper } from '@tryghost/helpers'
|
||||||
|
|
||||||
|
import config from '../../utils/siteConfig'
|
||||||
|
|
||||||
const PostCard = ({ post, isLarge }) => {
|
const PostCard = ({ post, isLarge }) => {
|
||||||
const url = `/${post.slug}/`
|
const url = `/${post.slug}/`
|
||||||
const readingTime = readingTimeHelper(post)
|
const readingTime = readingTimeHelper(post)
|
||||||
|
@ -13,7 +15,9 @@ const PostCard = ({ post, isLarge }) => {
|
||||||
<header className="post-card-header">
|
<header className="post-card-header">
|
||||||
{post.feature_image &&
|
{post.feature_image &&
|
||||||
<div className="post-card-image" style={{
|
<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>}
|
}}></div>}
|
||||||
</header>
|
</header>
|
||||||
<div className="post-card-content">
|
<div className="post-card-content">
|
||||||
|
|
Loading…
Reference in a new issue