| Total Complexity | 2 |
| Complexity/F | 0 |
| Lines of Code | 54 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { useStaticQuery, graphql } from "gatsby" |
||
| 2 | import React from "react" |
||
| 3 | import { Helmet } from "react-helmet" |
||
| 4 | |||
| 5 | export const Seo = ({ title, path }: SeoClassProps) => { |
||
| 6 | const { |
||
| 7 | site: { |
||
| 8 | siteMetadata: { description, siteUrl, title: titleTpl, subTitle }, |
||
| 9 | }, |
||
| 10 | }: SeoStaticSiteData = useStaticQuery(graphql` |
||
| 11 | { |
||
| 12 | site { |
||
| 13 | siteMetadata { |
||
| 14 | description |
||
| 15 | siteUrl |
||
| 16 | title |
||
| 17 | subTitle |
||
| 18 | } |
||
| 19 | } |
||
| 20 | } |
||
| 21 | `) |
||
| 22 | const canonicalUrl = path ? `${siteUrl}${path}` : null |
||
| 23 | const metaDescription = description || description |
||
| 24 | |||
| 25 | return ( |
||
| 26 | <Helmet |
||
| 27 | htmlAttributes={{ lang: `nl-BE` }} |
||
| 28 | title={title} |
||
| 29 | titleTemplate={`%s | ${titleTpl}`} |
||
| 30 | link={canonicalUrl ? [{ rel: `canonical`, href: canonicalUrl }] : []} |
||
| 31 | // TODO: METADATA |
||
| 32 | ></Helmet> |
||
| 33 | ) |
||
| 34 | } |
||
| 35 | |||
| 36 | type SeoStaticSiteData = { |
||
| 37 | site: { |
||
| 38 | siteMetadata: { |
||
| 39 | description?: string |
||
| 40 | siteUrl?: string |
||
| 41 | title: string |
||
| 42 | subTitle?: string |
||
| 43 | author?: string |
||
| 44 | fbAppId?: string |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | type SeoClassProps = { |
||
| 50 | title: string |
||
| 51 | path: string |
||
| 52 | description?: string |
||
| 53 | } |
||
| 54 |