|
1 | 1 | --- |
| 2 | +import { Schema } from "astro-seo-schema"; |
| 3 | +
|
2 | 4 | let { |
3 | | - page_info: { title, description, image, keywords }, |
| 5 | + page_info: { title, description, image, keywords }, |
4 | 6 | } = Astro.props; |
5 | 7 |
|
6 | 8 | // Get the site URL for JSON-LD |
7 | | -const canonicalURL = new URL(Astro.url.pathname, Astro.site || 'https://rishikc.com'); |
| 9 | +const canonicalURL = new URL( |
| 10 | + Astro.url.pathname, |
| 11 | + Astro.site || "https://rishikc.com", |
| 12 | +); |
8 | 13 | --- |
9 | 14 |
|
10 | | -<!-- <head> --> |
11 | | - <meta charset="UTF-8" /> |
12 | | - <title>{title}</title> |
13 | | - <meta name="viewport" content="width=device-width" /> |
14 | | - <link rel="icon" type="image/svg+xml" href={image} /> |
15 | | - <meta name="description" content={description} /> |
16 | | - <meta name="image" content={image} /> |
17 | | - {keywords ? <meta name="keywords" content={keywords} /> : null} |
18 | | - {/* Open graph / Facebook */} |
19 | | - <meta property="og:title" content={title} /> |
20 | | - <meta property="og:site_name" content={title} /> |
21 | | - <meta property="og:description" content={description} /> |
22 | | - <meta property="og:image" content={image} /> |
23 | | - <meta property="og:url" content={Astro.url.pathname} /> |
24 | | - {/* Twitter */} |
25 | | - <meta name="twitter:title" content={title} /> |
26 | | - <meta name="twitter:description" content={description} /> |
27 | | - <meta name="twitter:card" content="summary_large_image" /> |
28 | | - <meta name="twitter:image" content={image} /> |
| 15 | +<meta charset="UTF-8" /> |
| 16 | +<title>{title}</title> |
| 17 | +<meta name="viewport" content="width=device-width" /> |
| 18 | +<link rel="icon" type="image/svg+xml" href={image} /> |
| 19 | +<meta name="description" content={description} /> |
| 20 | +<meta name="image" content={image} /> |
| 21 | +{keywords ? <meta name="keywords" content={keywords} /> : null} |
| 22 | +{/* Open graph / Facebook */} |
| 23 | +<meta property="og:title" content={title} /> |
| 24 | +<meta property="og:site_name" content={title} /> |
| 25 | +<meta property="og:description" content={description} /> |
| 26 | +<meta property="og:image" content={image} /> |
| 27 | +<meta property="og:url" content={Astro.url.pathname} /> |
| 28 | +{/* Twitter */} |
| 29 | +<meta name="twitter:title" content={title} /> |
| 30 | +<meta name="twitter:description" content={description} /> |
| 31 | +<meta name="twitter:card" content="summary_large_image" /> |
| 32 | +<meta name="twitter:image" content={image} /> |
29 | 33 |
|
30 | | - <!-- WebSite JSON-LD Schema --> |
31 | | - <script type="application/ld+json"> |
32 | | - {JSON.stringify({ |
33 | | - "@context": "https://schema.org", |
34 | | - "@type": "WebSite", |
35 | | - "name": "Rishi Chawda", |
36 | | - "url": canonicalURL.toString(), |
37 | | - "description": description, |
38 | | - "potentialAction": { |
39 | | - "@type": "SearchAction", |
40 | | - "target": `${canonicalURL.origin}/search?q={search_term_string}`, |
41 | | - "query-input": "required name=search_term_string" |
42 | | - } |
43 | | - })} |
44 | | - </script> |
45 | | -<!-- </head> --> |
| 34 | +<!-- WebSite JSON-LD Schema --> |
| 35 | +<Schema |
| 36 | + item={{ |
| 37 | + "@context": "https://schema.org", |
| 38 | + "@type": "WebSite", |
| 39 | + name: "Rishi Chawda", |
| 40 | + url: canonicalURL.toString(), |
| 41 | + description: description, |
| 42 | + potentialAction: { |
| 43 | + "@type": "SearchAction", |
| 44 | + target: `${canonicalURL.origin}/search?q={search_term_string}`, |
| 45 | + "query-input": "required name=search_term_string", |
| 46 | + }, |
| 47 | + }} |
| 48 | +/> |
0 commit comments