mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-26 14:59:14 +01:00
bugfix/#741 - fix type of socialImage, fix condition
This commit is contained in:
parent
4a9648b189
commit
5c7fa10460
@ -19,7 +19,7 @@ const Layout = ({
|
|||||||
socialImage
|
socialImage
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { author, url } = useSiteMetadata();
|
const { author, url } = useSiteMetadata();
|
||||||
const metaImage = socialImage.length > 0 ? socialImage : author.photo;
|
const metaImage = typeof socialImage !== 'undefined' ? socialImage : author.photo;
|
||||||
const metaImageUrl = url + metaImage;
|
const metaImageUrl = url + metaImage;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -19,7 +19,7 @@ const PageTemplate = ({ data }: Props) => {
|
|||||||
const { frontmatter } = data.markdownRemark;
|
const { frontmatter } = data.markdownRemark;
|
||||||
const { title: pageTitle, description: pageDescription, socialImage } = frontmatter;
|
const { title: pageTitle, description: pageDescription, socialImage } = frontmatter;
|
||||||
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
|
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
|
||||||
const socialImageUrl = socialImage ? socialImage['publicURL'] : '';
|
const socialImageUrl = typeof socialImage !== 'undefined' ? socialImage['publicURL'] : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
||||||
|
@ -17,7 +17,7 @@ const PostTemplate = ({ data }: Props) => {
|
|||||||
const { frontmatter } = data.markdownRemark;
|
const { frontmatter } = data.markdownRemark;
|
||||||
const { title: postTitle, description: postDescription, socialImage } = frontmatter;
|
const { title: postTitle, description: postDescription, socialImage } = frontmatter;
|
||||||
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
|
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
|
||||||
const socialImageUrl = socialImage ? socialImage['publicURL'] : '';
|
const socialImageUrl = typeof socialImage !== 'undefined' ? socialImage['publicURL'] : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
||||||
|
Loading…
Reference in New Issue
Block a user