Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

seo.ts

30 lines898 Bytes

1export function seo(params: {
2 title: string
3 description?: string
4 keywords?: string
5 image?: string
6}) {
7 const { title, description, keywords, image } = params
8​
9 const tags = [
10 { title },
11 { name: 'description', content: description },
12 { name: 'keywords', content: keywords },
13 { name: 'twitter:title', content: title },
14 { name: 'twitter:description', content: description },
15 { name: 'twitter:creator', content: '@tannerlinsley' },
16 { name: 'twitter:site', content: '@tannerlinsley' },
17 { name: 'og:type', content: 'website' },
18 { name: 'og:title', content: title },
19 { name: 'og:description', content: description },
20 ...(image
21 ? [
22 { name: 'twitter:image', content: image },
23 { name: 'twitter:card', content: 'summary_large_image' },
24 { name: 'og:image', content: image },
25 ]
26 : []),
27 ]
28​
29 return tags