upstream #1

Merged
jblu merged 1007 commits from upstream into main 2024-11-04 22:35:57 -06:00
4 changed files with 87 additions and 11 deletions
Showing only changes of commit 2de139030f - Show all commits

View File

@ -82,7 +82,39 @@ You can start editing the page by modifying `pages/index.js`. The page auto-upda
`pages` - pages to route to. Read the [Next.js documentation](https://nextjs.org/docs) for more information `pages` - pages to route to. Read the [Next.js documentation](https://nextjs.org/docs) for more information
## Compose ## Post
### Frontmatter
Frontmatter follows [Hugo's standards](https://gohugo.io/content-management/front-matter/).
Currently 7 fields are supported.
```
title (required)
date (required)
tags (required, can be empty array)
lastmod (optional)
draft (optional)
summary (optional)
images (optional, adds to socialBanner in siteMetadata config)
```
Here's an example of a post's frontmatter:
```
---
title: 'Introducing Tailwind Nexjs Starter Blog'
date: '2021-01-12'
lastmod: '2021-01-18'
tags: ['next-js', 'tailwind', 'guide']
draft: false
summary: 'Looking for a performant, out of the box template, with all the best in web technology to support your blogging needs? Checkout the Tailwind Nextjs Starter Blog template.'
images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg']
---
```
### Compose
`scripts/compose.js` can be used to easily generate a post with pre-filled front matter. `scripts/compose.js` can be used to easily generate a post with pre-filled front matter.

View File

@ -47,12 +47,21 @@ export const PageSeo = ({ title, description, url }) => {
) )
} }
export const BlogSeo = ({ title, summary, date, url, tags, image = siteMetadata.socialBanner }) => { export const BlogSeo = ({ title, summary, date, lastmod, url, tags, images = [] }) => {
const publishedAt = new Date(date).toISOString() const publishedAt = new Date(date).toISOString()
const featuredImage = { const modifiedAt = new Date(lastmod || date).toISOString()
url: `${siteMetadata.siteUrl}${image}`, let imagesArr =
alt: title, typeof images === 'string'
} ? [images, siteMetadata.socialBanner]
: [...images, siteMetadata.socialBanner]
const featuredImages = imagesArr.map((img) => {
return {
url: `${siteMetadata.siteUrl}${img}`,
alt: title,
}
})
return ( return (
<> <>
<NextSeo <NextSeo
@ -63,22 +72,22 @@ export const BlogSeo = ({ title, summary, date, url, tags, image = siteMetadata.
type: 'article', type: 'article',
article: { article: {
publishedTime: publishedAt, publishedTime: publishedAt,
modifiedTime: publishedAt, modifiedTime: modifiedAt,
authors: [`${siteMetadata.siteUrl}/about`], authors: [`${siteMetadata.siteUrl}/about`],
tags, tags,
}, },
url, url,
title, title,
description: summary, description: summary,
images: [featuredImage], images: featuredImages,
}} }}
/> />
<ArticleJsonLd <ArticleJsonLd
authorName={siteMetadata.author} authorName={siteMetadata.author}
dateModified={publishedAt} dateModified={publishedAt}
datePublished={publishedAt} datePublished={modifiedAt}
description={summary} description={summary}
images={[featuredImage]} images={featuredImages}
publisherLogo="/static/favicons/android-chrome-96x96.png" publisherLogo="/static/favicons/android-chrome-96x96.png"
publisherName={siteMetadata.author} publisherName={siteMetadata.author}
title={title} title={title}

View File

@ -1,9 +1,11 @@
--- ---
title: 'Introducing Tailwind Nexjs Starter Blog' title: 'Introducing Tailwind Nexjs Starter Blog'
date: '2021-01-12' date: '2021-01-12'
lastmod: '2021-01-18'
tags: ['next-js', 'tailwind', 'guide'] tags: ['next-js', 'tailwind', 'guide']
draft: false draft: false
summary: 'Looking for a performant, out of the box template, with all the best in web technology to support your blogging needs? Checkout the Tailwind Nextjs Starter Blog template.' summary: 'Looking for a performant, out of the box template, with all the best in web technology to support your blogging needs? Checkout the Tailwind Nextjs Starter Blog template.'
images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg']
--- ---
![tailwind-nextjs-banner](/static/images/twitter-card.png) ![tailwind-nextjs-banner](/static/images/twitter-card.png)
@ -88,7 +90,39 @@ You can start editing the page by modifying `pages/index.js`. The page auto-upda
`pages` - pages to route to. Read the [Next.js documentation](https://nextjs.org/docs) for more information `pages` - pages to route to. Read the [Next.js documentation](https://nextjs.org/docs) for more information
## Compose ## Post
### Frontmatter
Frontmatter follows [Hugo's standards](https://gohugo.io/content-management/front-matter/).
Currently 7 fields are supported.
```
title (required)
date (required)
tags (required, can be empty array)
lastmod (optional)
draft (optional)
summary (optional)
images (optional, adds to socialBanner in siteMetadata config)
```
Here's an example of a post's frontmatter:
```
---
title: 'Introducing Tailwind Nexjs Starter Blog'
date: '2021-01-12'
lastmod: '2021-01-18'
tags: ['next-js', 'tailwind', 'guide']
draft: false
summary: 'Looking for a performant, out of the box template, with all the best in web technology to support your blogging needs? Checkout the Tailwind Nextjs Starter Blog template.'
images: ['/static/images/canada/mountains.jpg', '/static/images/canada/toronto.jpg']
---
```
### Compose
`scripts/compose.js` can be used to easily generate a post with pre-filled front matter. `scripts/compose.js` can be used to easily generate a post with pre-filled front matter.

View File

@ -21,6 +21,7 @@ date: '${date}'
tags: [] tags: []
draft: true draft: true
summary: summary:
images: []
--- ---
` `