Compare commits
10 commits
0109c51f83
...
6334dadf92
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6334dadf92 | ||
|
|
22ab2221fd | ||
|
|
d3a1f68045 | ||
|
|
92a2dccd91 | ||
|
|
1332ffbffa | ||
|
|
475a05fd03 | ||
|
|
77b33e837d | ||
|
|
95302075ef | ||
|
|
8d707b6683 | ||
|
|
462b941b71 |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 155 KiB |
|
|
@ -21,6 +21,14 @@ interface Props {
|
||||||
|
|
||||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
||||||
|
|
||||||
|
// For blog posts with date-slug format, show pretty URL in og:url/canonical
|
||||||
|
// This handles both direct /slug access and proxy /blog/slug access
|
||||||
|
const pathParts = Astro.url.pathname.split('/').filter(Boolean);
|
||||||
|
const blogPostMatch = pathParts[0] === 'blog' ? pathParts[1] : pathParts[0];
|
||||||
|
const isBlogPost = blogPostMatch?.match(/^\d{4}-\d{2}-\d{2}-/);
|
||||||
|
const finalCanonicalPath = isBlogPost ? `/${blogPostMatch}/` : Astro.url.pathname;
|
||||||
|
const finalCanonicalURL = new URL(finalCanonicalPath, Astro.site);
|
||||||
|
|
||||||
const { title, description, image = "/astro-micro.jpg" } = Astro.props;
|
const { title, description, image = "/astro-micro.jpg" } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -35,7 +43,7 @@ const { title, description, image = "/astro-micro.jpg" } = Astro.props;
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
|
|
||||||
<!-- Canonical URL -->
|
<!-- Canonical URL -->
|
||||||
<link rel="canonical" href={canonicalURL} />
|
<link rel="canonical" href={finalCanonicalURL} />
|
||||||
|
|
||||||
<!-- Primary Meta Tags -->
|
<!-- Primary Meta Tags -->
|
||||||
<title>{title}</title>
|
<title>{title}</title>
|
||||||
|
|
@ -44,17 +52,17 @@ const { title, description, image = "/astro-micro.jpg" } = Astro.props;
|
||||||
|
|
||||||
<!-- Open Graph / Facebook -->
|
<!-- Open Graph / Facebook -->
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content={Astro.url} />
|
<meta property="og:url" content={finalCanonicalURL} />
|
||||||
<meta property="og:title" content={title} />
|
<meta property="og:title" content={title} />
|
||||||
<meta property="og:description" content={description} />
|
<meta property="og:description" content={description} />
|
||||||
<meta property="og:image" content={new URL(image, Astro.url)} />
|
<meta property="og:image" content={new URL(image + '?v=2', Astro.url)} />
|
||||||
|
|
||||||
<!-- Twitter -->
|
<!-- Twitter -->
|
||||||
<meta property="twitter:card" content="summary_large_image" />
|
<meta property="twitter:card" content="summary_large_image" />
|
||||||
<meta property="twitter:url" content={Astro.url} />
|
<meta property="twitter:url" content={finalCanonicalURL} />
|
||||||
<meta property="twitter:title" content={title} />
|
<meta property="twitter:title" content={title} />
|
||||||
<meta property="twitter:description" content={description} />
|
<meta property="twitter:description" content={description} />
|
||||||
<meta property="twitter:image" content={new URL(image, Astro.url)} />
|
<meta property="twitter:image" content={new URL(image + '?v=2', Astro.url)} />
|
||||||
|
|
||||||
<!-- PageFind -->
|
<!-- PageFind -->
|
||||||
<link href="/pagefind/pagefind-ui.css" rel="stylesheet" />
|
<link href="/pagefind/pagefind-ui.css" rel="stylesheet" />
|
||||||
|
|
|
||||||