Update page template, post-template

This commit is contained in:
alxshelepenok 2020-11-01 03:47:19 +03:00
parent a0d1159934
commit 1c7e4a2cfc
4 changed files with 3146 additions and 4871 deletions

View File

@ -16,10 +16,10 @@ const Layout = ({
children,
title,
description,
socialImage
socialImage = ''
}: Props) => {
const { author, url } = useSiteMetadata();
const metaImage = typeof socialImage !== 'undefined' ? socialImage : author.photo;
const metaImage = socialImage || author.photo;
const metaImageUrl = url + metaImage;
return (

View File

@ -17,9 +17,9 @@ const PageTemplate = ({ data }: Props) => {
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
const { html: pageBody } = data.markdownRemark;
const { frontmatter } = data.markdownRemark;
const { title: pageTitle, description: pageDescription, socialImage } = frontmatter;
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
const socialImageUrl = typeof socialImage !== 'undefined' ? socialImage['publicURL'] : undefined;
const { title: pageTitle, description: pageDescription = '', socialImage } = frontmatter;
const metaDescription = pageDescription || siteSubtitle;
const socialImageUrl = socialImage?.publicURL;
return (
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >

View File

@ -15,9 +15,9 @@ type Props = {
const PostTemplate = ({ data }: Props) => {
const { title: siteTitle, subtitle: siteSubtitle } = useSiteMetadata();
const { frontmatter } = data.markdownRemark;
const { title: postTitle, description: postDescription, socialImage } = frontmatter;
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
const socialImageUrl = typeof socialImage !== 'undefined' ? socialImage['publicURL'] : undefined;
const { title: postTitle, description: postDescription = '', socialImage } = frontmatter;
const metaDescription = postDescription || siteSubtitle;
const socialImageUrl = socialImage?.publicURL;
return (
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription} socialImage={socialImageUrl} >

8001
yarn.lock

File diff suppressed because it is too large Load Diff