Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions app/[filename]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,31 +338,43 @@ export async function generateMetadata({ params }: { params: Promise<{ filename:
const category = await getCategoryData(filename);
if (category?.data?.category && category.data.category.__typename === "CategoryCategory") {
const categoryData = category.data.category as any;
const description = categoryData.seoDescription || undefined;
const canonicalUrl = `${siteUrl}/${filename}`;
const metadata: any = {
title: `${categoryData.title} | SSW.Rules`,
description,
alternates: {
canonical: `${siteUrl}/${filename}`,
canonical: canonicalUrl,
},
openGraph: {
title: `${categoryData.title} | SSW.Rules`,
description,
url: canonicalUrl,
type: "website",
},
};

if (categoryData.seoDescription) {
metadata.description = categoryData.seoDescription;
}

return metadata;
}

const rule = await getRuleData(filename);
if (rule?.data?.rule?.title) {
const description = rule.data.rule.seoDescription || extractBodyPreview(rule.data.rule.body) || undefined;
const canonicalUrl = `${siteUrl}/${filename}`;
const metadata: any = {
title: `${rule.data.rule.title} | SSW.Rules`,
description,
alternates: {
canonical: `${siteUrl}/${filename}`,
canonical: canonicalUrl,
},
openGraph: {
title: `${rule.data.rule.title} | SSW.Rules`,
description,
url: canonicalUrl,
type: "article",
},
};

metadata.description = rule.data.rule.seoDescription || extractBodyPreview(rule.data.rule.body) || undefined;

if (rule.data.rule.isArchived) {
metadata.robots = { index: false, follow: true };
}
Expand Down
29 changes: 26 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "@/styles.css";
import UserClientProvider from "@/components/auth/UserClientProvider";
import AppInsightsProvider from "@/components/providers/AppInsightsProvider";
import { TailwindIndicator } from "@/components/ui/breakpoint-indicator";
import { siteDescription, siteTitle, siteUrl, social } from "@/site-config";

const fontSans = FontSans({
subsets: ["latin"],
Expand All @@ -25,10 +26,32 @@ const lato = Lato({
weight: "400",
});

const DEFAULT_OG_IMAGE = "https://assets.tina.io/8a7b77f2-cde8-44e7-a592-ebeb7e9dc437/ssw-default-og.jpg";

export const metadata: Metadata = {
title: "SSW.Rules | Secret Ingredients to Quality Software (Open Source on GitHub)",
description:
"Secret Ingredients to Quality Software | SSW Rules provides best practices for developing secure, reliable, and efficient .NET, Azure, CRM, Angular, React, Dynamics, and AI applications. Learn more today!",
metadataBase: new URL("https://www.ssw.com.au"),
title: `${siteTitle} | Secret Ingredients to Quality Software (Open Source on GitHub)`,
description: siteDescription,
openGraph: {
title: `${siteTitle} | Secret Ingredients to Quality Software (Open Source on GitHub)`,
description: siteDescription,
siteName: siteTitle,
type: "website",
url: siteUrl,
images: [
{
url: DEFAULT_OG_IMAGE,
width: 1200,
height: 630,
alt: `${siteTitle} - Secret Ingredients to Quality Software`,
},
],
},
twitter: {
card: "summary_large_image",
site: `@${social.twitter}`,
creator: `@${social.twitter}`,
},
};

const jsonLd = [
Expand Down