update images meta

This commit is contained in:
Timothy 2021-01-18 23:41:48 +08:00
parent 2de139030f
commit 18fd946172
3 changed files with 7 additions and 5 deletions

View File

@ -97,7 +97,7 @@ tags (required, can be empty array)
lastmod (optional)
draft (optional)
summary (optional)
images (optional, adds to socialBanner in siteMetadata config)
images (optional, if none provided defaults to socialBanner in siteMetadata config)
```
Here's an example of a post's frontmatter:

View File

@ -51,9 +51,11 @@ export const BlogSeo = ({ title, summary, date, lastmod, url, tags, images = []
const publishedAt = new Date(date).toISOString()
const modifiedAt = new Date(lastmod || date).toISOString()
let imagesArr =
typeof images === 'string'
? [images, siteMetadata.socialBanner]
: [...images, siteMetadata.socialBanner]
images.length === 0
? [siteMetadata.socialBanner]
: typeof images === 'string'
? images
: [images]
const featuredImages = imagesArr.map((img) => {
return {

View File

@ -105,7 +105,7 @@ tags (required, can be empty array)
lastmod (optional)
draft (optional)
summary (optional)
images (optional, adds to socialBanner in siteMetadata config)
images (optional, if none provided defaults to socialBanner in siteMetadata config)
```
Here's an example of a post's frontmatter: