diff options
author | Valentin Popov <valentin@popov.link> | 2025-06-14 15:19:01 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2025-06-14 15:19:01 +0300 |
commit | 3d0f4857465e55815809719a4a4438e8a3cd16a0 (patch) | |
tree | 4d1f99d20eb3e9fd9439e1b367450ff2f5b33f8a /src/components/OpenGraph.astro | |
parent | 25ebd94466edcf87c675a12e3cf80b0ce572ab76 (diff) | |
download | popov.link-3d0f4857465e55815809719a4a4438e8a3cd16a0.tar.xz popov.link-3d0f4857465e55815809719a4a4438e8a3cd16a0.zip |
feat: add Open Graph and JSON-LD support to Head component
- Introduced OpenGraph component for enhanced social media sharing with Open Graph meta tags.
- Updated Head component to include OpenGraph and JSON-LD for improved SEO and structured data representation.
- Added comments for better clarity on meta tags and JSON-LD integration.
Diffstat (limited to 'src/components/OpenGraph.astro')
-rw-r--r-- | src/components/OpenGraph.astro | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/components/OpenGraph.astro b/src/components/OpenGraph.astro new file mode 100644 index 0000000..6ca1856 --- /dev/null +++ b/src/components/OpenGraph.astro @@ -0,0 +1,26 @@ +--- +import { config } from "../config"; + +type Props = { + readonly description: string; + readonly title: string; +}; + +const canonicalURL = new URL(Astro.url.pathname, Astro.site); +const { description, title } = Astro.props; + +const image = new URL(config.posts.defaultImage, Astro.site).toString(); +--- + +<!-- Open Graph --> +<meta property="og:type" content="website" /> +<meta property="og:title" content={title} /> +<meta property="og:description" content={description} /> +<meta property="og:image" content={image} /> +<meta property="og:url" content={canonicalURL} /> + +<!-- Twitter Cards --> +<meta name="twitter:card" content="summary_large_image" /> +<meta name="twitter:title" content={title} /> +<meta name="twitter:description" content={description} /> +<meta name="twitter:image" content={image} /> |