From f65eae6fd06e7caa4b6b64ca0b49a148745b0f4e Mon Sep 17 00:00:00 2001 From: 4lb Date: Thu, 26 Jun 2025 12:24:21 +0200 Subject: [PATCH] metatags fix --- src/layouts/BaseLayout.astro | 34 +++++++++++++++++++++++++++++----- src/pages/blog/[slug].astro | 26 ++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index c480c87a..683d8abc 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -30,16 +30,40 @@ const { url, title, description, featuredImage, imageWidth, imageHeight } = Astr content="width=device-width, initial-scale=1.0, viewport-fit=cover" /> - defguard - Zero-Trust WireGuard® 2FA/MFA VPN + {title} + + + + + + + + - - - + + - + + + + + + + + + + + + + + + + + + diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro index a648f0b2..0b16fe98 100644 --- a/src/pages/blog/[slug].astro +++ b/src/pages/blog/[slug].astro @@ -35,11 +35,22 @@ const url = `https://defguard.net/blog/${entry.slug}`; // Get image from frontmatter or extract from content const content = entry.body; const imageMatch = content.match(/!\[.*?\]\((.*?)\)/); +// Fix image URL construction - don't double-prefix with domain const imageUrl = entry.data.image - ? `https://defguard.net${entry.data.image}` + ? (entry.data.image.startsWith('http') ? entry.data.image : `https://defguard.net${entry.data.image}`) : imageMatch - ? `https://defguard.net${imageMatch[1]}` - : "https://defguard.net/images/png/defguard.png"; + ? (imageMatch[1].startsWith('http') ? imageMatch[1] : `https://defguard.net${imageMatch[1]}`) + : "defguard.net/images/png/defguard.png"; + +// Generate relevant tags for blog post +const blogTags = [ + "defguard", + "blog", + "cybersecurity", + "vpn", + "zero-trust", + ...(entry.data.tags || []), +]; // Check if case study metadata exists const hasCaseStudy = @@ -53,8 +64,15 @@ const hasCaseStudy = featuredImage={imageUrl} imageWidth="1200" imageHeight="630" - tags={[]} + tags={blogTags} > + + + + {entry.data.author && } + + {blogTags.map(tag => )} +