mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-04-07 15:50:55 +02:00
Update page template, post-template
This commit is contained in:
parent
a0d1159934
commit
1c7e4a2cfc
@ -16,10 +16,10 @@ const Layout = ({
|
|||||||
children,
|
children,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
socialImage
|
socialImage = ''
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { author, url } = useSiteMetadata();
|
const { author, url } = useSiteMetadata();
|
||||||
const metaImage = typeof socialImage !== 'undefined' ? socialImage : author.photo;
|
const metaImage = socialImage || author.photo;
|
||||||
const metaImageUrl = url + metaImage;
|
const metaImageUrl = url + metaImage;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -17,9 +17,9 @@ const PageTemplate = ({ data }: Props) => {
|
|||||||
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
||||||
const { html: pageBody } = data.markdownRemark;
|
const { html: pageBody } = data.markdownRemark;
|
||||||
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 || siteSubtitle;
|
||||||
const socialImageUrl = typeof socialImage !== 'undefined' ? socialImage['publicURL'] : undefined;
|
const socialImageUrl = socialImage?.publicURL;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
||||||
|
@ -15,9 +15,9 @@ type Props = {
|
|||||||
const PostTemplate = ({ data }: Props) => {
|
const PostTemplate = ({ data }: Props) => {
|
||||||
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
|
||||||
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 || siteSubtitle;
|
||||||
const socialImageUrl = typeof socialImage !== 'undefined' ? socialImage['publicURL'] : undefined;
|
const socialImageUrl = socialImage?.publicURL;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >
|
||||||
|
Loading…
x
Reference in New Issue
Block a user