Skip to content

Commit

Permalink
content: update and add webpage schema markup to pages
Browse files Browse the repository at this point in the history
  • Loading branch information
shah-iq committed Oct 9, 2024
1 parent 59c09c6 commit 1c4fdf1
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 109 deletions.
14 changes: 0 additions & 14 deletions src/layouts/MainLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,6 @@ We set the language of the page to English and add classes for scrollbar and scr
<script>
import "@scripts/lenisSmoothScroll.js";
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Website",
"name": " Compliance Evidence Automation for Continuous Security - Surveilr",
"description": "Automate compliance evidence for continuous security with Surveilr’s free secure, auditable, and local-first solutions.",
"url": "https://www.surveilr.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "https://www.surveilr.com/{search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
<script type="application/ld+json">
[
{
Expand Down
53 changes: 35 additions & 18 deletions src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,44 @@ const socialImageRes = await getImage({
height: 600,
});
const socialImage = Astro.url.origin + socialImageRes.src;
const structuredData: object = {
"@context": "https://schema.org",
"@type": "BlogPosting",
mainEntityOfPage: {
"@type": "WebPage",
"@id": `https://www.surveilr.com/blog/${post.slug.replace(/^en\//, "")}/`,
const structuredData: object = [
{
"@context": "https://schema.org",
"@type": "BlogPosting",
mainEntityOfPage: {
"@type": "WebPage",
"@id": `https://www.surveilr.com/blog/${post.slug.replace(/^en\//, "")}/`,
},
headline: metaTitle,
description: post.data.description,
image: socialImage,
publisher: {
"@type": "Organization",
name: "Surveilr",
logo: {
"@type": "ImageObject",
url: "https://www.surveilr.com/_astro/surveilr-logo-with-text-264x66px.CdbY10CM_ZAn8Qa.webp",
},
},
datePublished: post.data.pubDate,
dateModified: post.data.pubDate,
},
headline: metaTitle,
description: post.data.description,
image: socialImage,
publisher: {
"@type": "Organization",
name: "Surveilr",
logo: {
"@type": "ImageObject",
url: "https://www.surveilr.com/_astro/surveilr-logo-with-text-264x66px.CdbY10CM_ZAn8Qa.webp",
{
"@context": "https://schema.org",
"@type": "WebPage",
name: metaTitle,
url: Astro.url.href,
description: post.data.description,
publisher: {
"@type": "Organization",
name: "Surveilr",
logo: {
"@type": "ImageObject",
url: "https://www.surveilr.com/_astro/surveilr-logo-without-tagline.DVJj0veE_1F2RH4.webp",
},
},
},
datePublished: post.data.pubDate,
dateModified: post.data.pubDate,
};
];
---

<MainLayout
Expand Down
18 changes: 17 additions & 1 deletion src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,25 @@ const secondSubTitle: string =
"Stay up-to-date with the latest trends and developments in the compliance industry with insights from our team of industry experts. ";
const pageTitle: string = `Blog | ${SITE.title}`;
const webPageSchema = {
"@context": "https://schema.org",
"@type": "WebPage",
name: pageTitle,
url: Astro.url.href,
description: SITE.description,
publisher: {
"@type": "Organization",
name: "Surveilr",
logo: {
"@type": "ImageObject",
url: "https://www.surveilr.com/_astro/surveilr-logo-without-tagline.DVJj0veE_1F2RH4.webp",
},
},
};
---

<MainLayout title={pageTitle} structuredData={{}}>
<MainLayout title={pageTitle} structuredData={webPageSchema}>
<section
class="mx-auto max-w-[85rem] space-y-8 px-4 pt-16 sm:px-6 lg:px-8 2xl:max-w-full"
>
Expand Down
18 changes: 17 additions & 1 deletion src/pages/contact.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@ import ContactSection from "@components/sections/misc/ContactSection.astro";
import { SITE } from "@data/constants";
const pageTitle: string = `Contact | ${SITE.title}`;
const webPageSchema = {
"@context": "https://schema.org",
"@type": "WebPage",
name: pageTitle,
url: Astro.url.href,
description: SITE.description,
publisher: {
"@type": "Organization",
name: "Surveilr",
logo: {
"@type": "ImageObject",
url: "https://www.surveilr.com/_astro/surveilr-logo-without-tagline.DVJj0veE_1F2RH4.webp",
},
},
};
---

<!--Utilizing MainLayout for the outer layout of the page, and defining meta for SEO purposes-->
<MainLayout title={pageTitle}>
<MainLayout title={pageTitle} structuredData={webPageSchema}>
<ContactSection />
</MainLayout>
31 changes: 23 additions & 8 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,29 @@ const pageTitle: string =
"Compliance Evidence Automation for Continuous Security - Surveilr";
const pageDescription: string =
"Automate compliance evidence for continuous security with Surveilr’s free secure, auditable, and local-first solutions.";
const structuredData: object = {
"@context": "https://schema.org",
"@type": "Organization",
name: "Compliance Evidence Automation for Continuous Security - Surveilr",
alternateName: "Surveilr",
url: "https://www.surveilr.com/",
logo: "https://www.surveilr.com/_astro/surveilr-logo-with-text-264x66px.CdbY10CM_ZAn8Qa.webp",
};
const structuredData: object = [
{
"@context": "https://schema.org",
"@type": "Organization",
name: "Compliance Evidence Automation for Continuous Security - Surveilr",
alternateName: "Surveilr",
url: "https://www.surveilr.com/",
logo: "https://www.surveilr.com/_astro/surveilr-logo-with-text-264x66px.CdbY10CM_ZAn8Qa.webp",
},
{
"@context": "https://schema.org",
"@type": "Website",
name: " Compliance Evidence Automation for Continuous Security - Surveilr",
description:
"Automate compliance evidence for continuous security with Surveilr’s free secure, auditable, and local-first solutions.",
url: "https://www.surveilr.com/",
potentialAction: {
"@type": "SearchAction",
target: "https://www.surveilr.com/{search_term_string}",
"query-input": "required name=search_term_string",
},
},
];
---

<MainLayout
Expand Down
42 changes: 29 additions & 13 deletions src/pages/pattern/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare global {
export async function getStaticPaths() {
const patternEntries = await getCollection("patterns", ({ id }) =>
id.startsWith("en/")
id.startsWith("en/"),
);
return patternEntries.map((pattern) => {
const slugWithoutLang = pattern.slug.replace(/^en\//, ""); // Remove the "en/" prefix
Expand All @@ -32,9 +32,25 @@ export async function getStaticPaths() {
const { pattern } = Astro.props;
const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
const webPageSchema = {
"@context": "https://schema.org",
"@type": "WebPage",
name: pageTitle,
url: Astro.url.href,
description: SITE.description,
publisher: {
"@type": "Organization",
name: "Surveilr",
logo: {
"@type": "ImageObject",
url: "https://www.surveilr.com/_astro/surveilr-logo-without-tagline.DVJj0veE_1F2RH4.webp",
},
},
};
---

<MainLayout title={pageTitle}>
<MainLayout title={pageTitle} structuredData={webPageSchema}>
<div id="overlay" class="fixed inset-0 bg-neutral-200 dark:bg-neutral-800">
</div>

Expand Down Expand Up @@ -184,7 +200,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
>
{header}
</th>
)
),
)}
</tr>
</thead>
Expand All @@ -201,7 +217,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
</td>
))}
</tr>
))
)),
)}
</tbody>
</table>
Expand Down Expand Up @@ -263,7 +279,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;

function setElementAnimationDefaults(
id: string,
settings: AnimationSettings
settings: AnimationSettings,
) {
gsap.set(id, settings);
}
Expand Down Expand Up @@ -299,13 +315,13 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
timeline.to(
"#fadeInUp",
{ duration: 1.5, autoAlpha: 1, y: 0, ease: "power2.out" },
"-=1.2"
"-=1.2",
);

timeline.to(
"#fadeInMoveRight",
{ duration: 1.5, autoAlpha: 1, x: 0, ease: "power2.inOut" },
"-=1.4"
"-=1.4",
);

timeline.to("#overlay", { duration: 1, autoAlpha: 0, delay: 0.2 });
Expand All @@ -318,7 +334,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
"active",
"bg-neutral-100",
"hover:border-transparent",
"dark:bg-white/[.05]"
"dark:bg-white/[.05]",
);

const tabId = btn.getAttribute("data-target");
Expand All @@ -332,7 +348,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
changeHeadingStyle(
btn,
["text-neutral-800", "dark:text-neutral-200"],
["text-orange-400", "dark:text-orange-300"]
["text-orange-400", "dark:text-orange-300"],
);
}
}
Expand All @@ -342,7 +358,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
"active",
"bg-neutral-100",
",hover:border-transparent",
"dark:bg-white/[.05]"
"dark:bg-white/[.05]",
);

const tabId = button.getAttribute("data-target");
Expand All @@ -356,14 +372,14 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
changeHeadingStyle(
button,
["text-orange-400", "dark:text-orange-300"],
["text-neutral-800", "dark:text-neutral-200"]
["text-neutral-800", "dark:text-neutral-200"],
);
}

function changeHeadingStyle(
button: any,
addClasses: any,
removeClasses: any
removeClasses: any,
) {
let heading = button.querySelector("span");
if (heading) {
Expand All @@ -378,7 +394,7 @@ const pageTitle: string = `${pattern.data.title} | ${SITE.title}`;
changeHeadingStyle(
tabButtons[0],
["text-orange-400", "dark:text-orange-300"],
[]
[],
);
}

Expand Down
Loading

0 comments on commit 1c4fdf1

Please sign in to comment.