Skip to content
Merged
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
Binary file added app/public/assets/policyengine-social-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions app/website.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
/>
<meta
property="og:image"
content="https://policyengine.org/assets/logos/policyengine/teal.png"
content="https://policyengine.org/assets/policyengine-social-preview.png"
/>
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="PolicyEngine" />
<meta property="og:url" content="https://policyengine.org" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="PolicyEngine" />
Expand All @@ -48,8 +51,9 @@
/>
<meta
name="twitter:image"
content="https://policyengine.org/assets/logos/policyengine/teal.png"
content="https://policyengine.org/assets/policyengine-social-preview.png"
/>
<meta name="twitter:image:alt" content="PolicyEngine" />
</head>
<body>
<div id="root"></div>
Expand Down
40 changes: 40 additions & 0 deletions website/src/__tests__/layout/root-layout.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { describe, expect, test } from "vitest";
import { metadata } from "../../app/layout";

const SOCIAL_PREVIEW_IMAGE = "/assets/policyengine-social-preview.png";

describe("RootLayout metadata", () => {
test("includes default social preview metadata", () => {
expect(metadata.openGraph).toEqual(
expect.objectContaining({
title: "PolicyEngine",
description: metadata.description,
siteName: "PolicyEngine",
type: "website",
images: [
{
url: SOCIAL_PREVIEW_IMAGE,
width: 1200,
height: 630,
alt: "PolicyEngine",
},
],
}),
);

expect(metadata.twitter).toEqual(
expect.objectContaining({
card: "summary_large_image",
site: "@ThePolicyEngine",
title: "PolicyEngine",
description: metadata.description,
images: [
{
url: SOCIAL_PREVIEW_IMAGE,
alt: "PolicyEngine",
},
],
}),
);
});
});
30 changes: 28 additions & 2 deletions website/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,44 @@ import { SpeedInsights } from "@vercel/speed-insights/next";
import "./globals.css";

const GA_MEASUREMENT_ID = "G-2YHG89FY0N";
const SITE_DESCRIPTION =
"Free, open-source tools to understand tax and benefit policies. Calculate your taxes and benefits, or analyze policy reforms.";
const SOCIAL_PREVIEW_IMAGE = {
url: "/assets/policyengine-social-preview.png",
width: 1200,
height: 630,
alt: "PolicyEngine",
};

export const metadata: Metadata = {
metadataBase: new URL("https://www.policyengine.org"),
title: {
template: "%s | PolicyEngine",
default: "PolicyEngine",
},
description:
"Free, open-source tools to understand tax and benefit policies. Calculate your taxes and benefits, or analyze policy reforms.",
description: SITE_DESCRIPTION,
icons: {
icon: "/favicon.svg",
},
openGraph: {
title: "PolicyEngine",
description: SITE_DESCRIPTION,
siteName: "PolicyEngine",
type: "website",
images: [SOCIAL_PREVIEW_IMAGE],
},
twitter: {
card: "summary_large_image",
site: "@ThePolicyEngine",
title: "PolicyEngine",
description: SITE_DESCRIPTION,
images: [
{
url: SOCIAL_PREVIEW_IMAGE.url,
alt: SOCIAL_PREVIEW_IMAGE.alt,
},
],
},
};

export default function RootLayout({
Expand Down
Loading