Fix broken builds when trying to run regex on empty content

This commit is contained in:
Hippo 2019-10-06 18:10:22 +05:30
parent 63421d67e4
commit 2611aa208d
2 changed files with 2 additions and 2 deletions

View file

@ -35,7 +35,7 @@ const Page = ({ data, location }) => {
{/* The main page content */}
<section
className="content-body load-external-scripts"
dangerouslySetInnerHTML={{ __html: page.html.replace(new RegExp(config.mediaUrlFrom, 'g'), config.mediaUrlTo) }}
dangerouslySetInnerHTML={{ __html: page.html ? page.html.replace(new RegExp(config.mediaUrlFrom, 'g'), config.mediaUrlTo) : page.html }}
/>
</article>
</div>

View file

@ -40,7 +40,7 @@ const Post = ({ data, location }) => {
{/* The main post content */ }
<section
className="content-body load-external-scripts"
dangerouslySetInnerHTML={{ __html: post.html.replace(new RegExp(config.mediaUrlFrom, 'g'), config.mediaUrlTo) }}
dangerouslySetInnerHTML={{ __html: post.html ? post.html.replace(new RegExp(config.mediaUrlFrom, 'g'), config.mediaUrlTo) : post.html }}
/>
<section className="content-footer">
<p>