mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
fix: improve SEO types
This commit is contained in:
@@ -3,13 +3,20 @@ import Helmet from "react-helmet"
|
|||||||
import { useStaticQuery, graphql } from "gatsby"
|
import { useStaticQuery, graphql } from "gatsby"
|
||||||
|
|
||||||
interface SEOProps {
|
interface SEOProps {
|
||||||
readonly description: string
|
readonly description?: string
|
||||||
readonly lang: string
|
readonly lang?: string
|
||||||
readonly meta: object[]
|
readonly meta?: any[]
|
||||||
|
readonly keywords?: string[]
|
||||||
readonly title: string
|
readonly title: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const SEO = ({ description = "", lang = "en", meta = [], title }: SEOProps) => {
|
const SEO = ({
|
||||||
|
description,
|
||||||
|
lang = "en",
|
||||||
|
meta = [],
|
||||||
|
keywords = [],
|
||||||
|
title,
|
||||||
|
}: SEOProps) => {
|
||||||
const { site } = useStaticQuery(
|
const { site } = useStaticQuery(
|
||||||
graphql`
|
graphql`
|
||||||
query {
|
query {
|
||||||
@@ -66,7 +73,16 @@ const SEO = ({ description = "", lang = "en", meta = [], title }: SEOProps) => {
|
|||||||
name: `twitter:description`,
|
name: `twitter:description`,
|
||||||
content: metaDescription,
|
content: metaDescription,
|
||||||
},
|
},
|
||||||
]}
|
]
|
||||||
|
.concat(
|
||||||
|
keywords.length > 0
|
||||||
|
? {
|
||||||
|
name: `keywords`,
|
||||||
|
content: keywords.join(`, `),
|
||||||
|
}
|
||||||
|
: []
|
||||||
|
)
|
||||||
|
.concat(meta)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user