fix: rss tags

This commit is contained in:
Gautier Arcin 2021-08-09 20:55:52 +02:00
parent b0253c2a16
commit d1264d132a
2 changed files with 30 additions and 2 deletions

View File

@ -24,6 +24,34 @@ export const PageSeo = ({ title, description }) => {
)
}
export const TagSeo = ({ title, description }) => {
const router = useRouter()
return (
<Head>
<title>{`${title}`}</title>
<meta name="robots" content="follow, index" />
<meta name="description" content={description} />
<meta property="og:url" content={`${siteMetadata.siteUrl}${router.asPath}`} />
<meta property="og:type" content="website" />
<meta property="og:site_name" content={siteMetadata.title} />
<meta property="og:description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:image" content={`${siteMetadata.siteUrl}${siteMetadata.socialBanner}`} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content={siteMetadata.twitter} />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={`${siteMetadata.siteUrl}${siteMetadata.socialBanner}`} />
<link
rel="alternate"
type="application/rss+xml"
title={`${description} - RSS feed`}
href={`${siteMetadata.siteUrl}${router.asPath}/feed.xml`}
/>
</Head>
)
}
export const BlogSeo = ({ authorDetails, title, summary, date, lastmod, url, images = [] }) => {
const router = useRouter()
const publishedAt = new Date(date).toISOString()

View File

@ -1,4 +1,4 @@
import { PageSeo } from '@/components/SEO'
import { TagSeo } from '@/components/SEO'
import siteMetadata from '@/data/siteMetadata'
import ListLayout from '@/layouts/ListLayout'
import generateRss from '@/lib/generate-rss'
@ -43,7 +43,7 @@ export default function Tag({ posts, tag }) {
const title = tag[0].toUpperCase() + tag.split(' ').join('-').slice(1)
return (
<>
<PageSeo
<TagSeo
title={`${tag} - ${siteMetadata.title}`}
description={`${tag} tags - ${siteMetadata.title}`}
/>