Skip to content

Commit 052acf7

Browse files
authored
feat: update structured data to include additional social profile link for improved SEO
1 parent 1969914 commit 052acf7

13 files changed

Lines changed: 54 additions & 20 deletions

File tree

astro.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export default defineConfig({
5858
const url = item.url;
5959
let priority = 0.5;
6060
let changefreq = "monthly";
61+
const lastmod = item.lastmod ?? new Date().toISOString();
6162

6263
// Homepage gets highest priority
6364
if (url === "https://avaabrazzaq.com/") {
@@ -103,8 +104,8 @@ export default defineConfig({
103104
return {
104105
...item,
105106
changefreq: changefreq as typeof item.changefreq,
107+
lastmod,
106108
priority,
107-
// Note: lastmod is automatically added by Astro sitemap when available
108109
};
109110
},
110111
}),

public/robots.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
User-agent: *
22
Allow: /
33
Sitemap: https://avaabrazzaq.com/sitemap-index.xml
4-
Host: avaabrazzaq.com
54

65
# Search engine crawlers
76
User-agent: Googlebot

src/components/FooterNav.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const currentYear = new Date().getFullYear();
66
const socialLinks = [
77
{
88
kind: "linkedin" as const,
9-
href: "https://www.linkedin.com/in/ar10dev",
9+
href: "https://linkedin.com/in/avaab-razzaq-937b89366",
1010
label: "LinkedIn",
1111
trackId: "footer_open_linkedin",
1212
},

src/components/HeadSEO.astro

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type Props = {
44
description: string;
55
canonicalUrl: string;
66
ogImage: string;
7+
ogImageAlt?: string;
78
ogType?: string;
89
author?: string;
910
robots?: string;
@@ -18,6 +19,7 @@ const {
1819
description,
1920
canonicalUrl,
2021
ogImage,
22+
ogImageAlt = `Open Graph preview image for ${title}`,
2123
ogType = "website",
2224
author = "Avaab Razzaq",
2325
robots = "index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1",
@@ -34,6 +36,7 @@ const {
3436
<meta name="robots" content={robots} />
3537
{keywords && <meta name="keywords" content={keywords} />}
3638

39+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
3740
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
3841
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
3942
<link rel="canonical" href={canonicalUrl} />
@@ -51,6 +54,13 @@ const {
5154
href="https://fonts.googleapis.com/css2?family=Manrope:wght@300..800&family=Sora:wght@300..800&display=swap"
5255
rel="stylesheet"
5356
/>
57+
<link
58+
rel="preload"
59+
as="font"
60+
href="https://fonts.gstatic.com/l/font?kit=xn7_YHE41ni1AdIRqAuZuw1Bx9mbZk79FO_F64i4O4WET_H2iUHf7Dgpp0RKqtXwOQUkN-5Sy2P5jjO7ilYrPP4hMRNnwr-cMmAcp2R1jDhb&skey=c397ded15edc0853&v=v20"
61+
type="font/ttf"
62+
crossorigin
63+
/>
5464

5565
<title>{title}</title>
5666

@@ -60,7 +70,7 @@ const {
6070
<meta property="og:description" content={description} />
6171
<meta property="og:url" content={canonicalUrl} />
6272
<meta property="og:image" content={ogImage} />
63-
<meta property="og:image:alt" content={title} />
73+
<meta property="og:image:alt" content={ogImageAlt} />
6474
<meta property="og:image:width" content="1200" />
6575
<meta property="og:image:height" content="630" />
6676
<meta property="og:image:type" content="image/png" />
@@ -72,7 +82,7 @@ const {
7282
<meta name="twitter:title" content={title} />
7383
<meta name="twitter:description" content={description} />
7484
<meta name="twitter:image" content={ogImage} />
75-
<meta name="twitter:image:alt" content={title} />
85+
<meta name="twitter:image:alt" content={ogImageAlt} />
7686
<meta name="twitter:label1" content="Built by" />
7787
<meta name="twitter:data1" content="Avaab Razzaq" />
7888
{readingTime ? (

src/env.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/// <reference types="astro/client" />
22

3-
interface ImportMetaEnv {
4-
readonly PUBLIC_GA_MEASUREMENT_ID?: string;
3+
export {};
4+
5+
declare global {
6+
interface ImportMetaEnv {
7+
readonly PUBLIC_GA_MEASUREMENT_ID?: string;
8+
}
59
}

src/layouts/BaseLayout.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ const currentPath = Astro.url.pathname;
9292

9393
<slot name="head" />
9494

95-
{publishedTime && <meta property="article:published_time" content={publishedTime} />}
96-
{publishedTime && <meta property="article:author" content={author} />}
97-
{modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
98-
{articleSection && <meta property="article:section" content={articleSection} />}
95+
{ogType === "article" && publishedTime && <meta property="article:published_time" content={publishedTime} />}
96+
{ogType === "article" && <meta property="article:author" content={author} />}
97+
{ogType === "article" && modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
98+
{ogType === "article" && articleSection && <meta property="article:section" content={articleSection} />}
9999

100100
<script is:inline set:html={themeInitScript}></script>
101101
</head>

src/layouts/ServiceLayout.astro

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type Props = {
2727
serviceDescription: string;
2828
keywords?: string[];
2929
ogImage?: string;
30+
ogType?: "website" | "article" | "profile";
3031
faqs?: { question: string; answer: string }[];
3132
publishedTime?: string;
3233
modifiedTime?: string;
@@ -52,6 +53,7 @@ const {
5253
serviceDescription,
5354
keywords = [],
5455
ogImage,
56+
ogType = "website",
5557
faqs = [],
5658
publishedTime,
5759
modifiedTime,
@@ -300,13 +302,13 @@ const structuredData = {
300302
description={seoDescription}
301303
canonicalUrl={canonicalUrl}
302304
ogImage={finalOgImage}
303-
ogType="website"
305+
ogType={ogType}
304306
keywords={finalKeywords}
305307
structuredData={structuredData}
306308
/>
307309

308-
{publishedTime && <meta property="article:published_time" content={publishedTime} />}
309-
{modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
310+
{ogType === "article" && publishedTime && <meta property="article:published_time" content={publishedTime} />}
311+
{ogType === "article" && modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
310312

311313
<script is:inline set:html={themeInitScript}></script>
312314
</head>

src/pages/about/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const icons: Record<string, string> = {
191191
};
192192
---
193193

194-
<BaseLayout title={title} description={description} canonicalUrl={canonicalUrl} ogImage="https://avaabrazzaq.com/og-about.png" structuredData={structuredData}>
194+
<BaseLayout title={title} description={description} canonicalUrl={canonicalUrl} ogImage={`${siteUrl}/og-about.png`} structuredData={structuredData}>
195195
<div class="min-h-screen">
196196
{/* Hero Section */}
197197
<section class="bg-[var(--surface-elevated)] py-16 md:py-24">

src/pages/blog/index.astro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ const structuredData = {
4949
name: title,
5050
description: description,
5151
isPartOf: { "@id": `${siteUrl}/#website` },
52+
hasPart: sortedPosts.map((post, index) => ({
53+
"@type": "BlogPosting",
54+
"@id": `${siteUrl}/blog/${post.id}/`,
55+
headline: post.data.title,
56+
description: post.data.description,
57+
url: `${siteUrl}/blog/${post.id}/`,
58+
datePublished: post.data.publishDate.toISOString(),
59+
dateModified:
60+
post.data.updatedDate?.toISOString() ??
61+
post.data.publishDate.toISOString(),
62+
author: { "@id": `${siteUrl}/#person` },
63+
position: index + 1,
64+
})),
5265
about: {
5366
"@type": "Blog",
5467
name: "Avaab Razzaq Blog",
@@ -132,6 +145,8 @@ const structuredData = {
132145
<img
133146
src={post.data.image.src}
134147
alt={post.data.image.alt}
148+
width="800"
149+
height="450"
135150
class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"
136151
loading="lazy"
137152
/>

src/pages/contact/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ const contactMethods = [
120120
{
121121
title: "LinkedIn",
122122
description: "Connect professionally",
123-
value: "linkedin.com/in/ar10dev",
124-
href: "https://www.linkedin.com/in/ar10dev",
123+
value: "linkedin.com/in/avaab-razzaq-937b89366",
124+
href: "https://linkedin.com/in/avaab-razzaq-937b89366",
125125
icon: `<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24"><path d="M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.32 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.79M6.88 8.56a1.68 1.68 0 0 0 1.68-1.68c0-.93-.75-1.69-1.68-1.69a1.69 1.69 0 0 0-1.69 1.69c0 .93.76 1.68 1.69 1.68m1.39 9.94v-8.37H5.5v8.37h2.77z"/></svg>`,
126126
},
127127
];

0 commit comments

Comments
 (0)