Skip to content

Commit

Permalink
Merge pull request #684 from AZBL/AZBL/588-improve-social-media-thumb…
Browse files Browse the repository at this point in the history
…nail-and-title

Azbl/588 improve social media thumbnail and title
  • Loading branch information
nlebovits authored Jun 10, 2024
2 parents 8163838 + 442de71 commit 267ca36
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 30 deletions.
Binary file added public/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions src/app/(content-pages)/about/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const metadata = {
title: "About",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "About";
const description =
"Philadelphia has a gun violence problem. Clean & Green Philly empowers Philadelphians to take action to solve it.";
const url = "/about";

export const metadata = generateMetadata({
title,
description,
url,
});

const AboutLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
15 changes: 12 additions & 3 deletions src/app/(content-pages)/gentrification/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const metadata = {
title: "Gentrification",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Gentrification";
const url = "/gentrification";
const description =
"At Clean & Green Philly, we try to avoid contributing to green gentrification here in Philadelphia.";

export const metadata = generateMetadata({
title,
url,
description,
});

const GentrificationLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
15 changes: 12 additions & 3 deletions src/app/(content-pages)/get-access/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const metadata = {
title: "Get Access",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Get Access";
const description =
"In order to intervene in a property, you need to have some kind of legal access to do so.";
const url = "/get-access";

export const metadata = generateMetadata({
title,
description,
url,
});

const GetAccessLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
14 changes: 11 additions & 3 deletions src/app/(content-pages)/legal-disclaimer/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
export const metadata = {
title: "Legal Disclaimer",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Legal Disclaimer";
const description = "Acceptance of Terms and Conditions of Use";
const url = "/legal-disclaimer";

export const metadata = generateMetadata({
title,
description,
url,
});

const LegalDisclaimerLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
15 changes: 12 additions & 3 deletions src/app/(content-pages)/methodology/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const metadata = {
title: "Methodology",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Methodology";
const description =
"Clean & Green Philly combines several public datasets to categorize Philadelphia’s vacant properties based on how important it is that someone intervene there.";
const url = "/methodology";

export const metadata = generateMetadata({
title,
description,
url,
});

const MethodologyLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
14 changes: 11 additions & 3 deletions src/app/(content-pages)/request-removal/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
export const metadata = {
title: "Request Removal",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Request Removal";
const description = "Request to Remove a Property Listing";
const url = "/request-removal";

export const metadata = generateMetadata({
title,
description,
url,
});

const RequestRemovalLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
15 changes: 12 additions & 3 deletions src/app/(content-pages)/take-action-overview/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const metadata = {
title: "Overview",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Overview";
const description =
"Clean & Green Philly can help you prioritize vacant properties to return to productive use.";
const url = "/take-action-overview";

export const metadata = generateMetadata({
title,
description,
url,
});

const OverviewLayout = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>;
Expand Down
15 changes: 12 additions & 3 deletions src/app/(content-pages)/transform-property/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const metadata = {
title: "Transform a Property",
};
import { generateMetadata } from "@/utilities/generateMetaData";

const title = "Transform a Property";
const description =
"After gaining access to the property, you can transform a property to improve the quality of life in the neighborhood.";
const url = "/transform-property";

export const metadata = generateMetadata({
title,
description,
url,
});

const TransformPropertyLayout = ({
children,
Expand Down
13 changes: 10 additions & 3 deletions src/app/find-properties/[[...opa_id]]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { Header, Hotjar } from "@/components";
import { generateMetadata } from "@/utilities/generateMetaData";
import CookieConsentBanner from "@/components/CookieConsentBanner";

export const metadata = {
title: "Find Properties",
};
const title = "Find Properties";
const url = "/find-properties";
const description =
"You can search and find vacant properties that match your goals. Use our data to understand those properties and how to take action.";

export const metadata = generateMetadata({
title,
url,
description,
});
const MapLayout = ({ children }: { children: React.ReactNode }) => {
return (
<div className="overflow-hidden">
Expand Down
31 changes: 28 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,41 @@ import "./globals.css";
import { CookieProviderWrapper } from "./CookieProviderWrapper";
import { FilterProviderWrapper } from "./FilterProviderWrapper";

const defaultTitle =
"Clean & Green Philly - Helping communities clean vacant properties";
const description =
"The ultimate toolkit to help community groups clean and green vacant properties to reduce gun violence in Philadelphia.";
const siteUrl = new URL("https://staging.cleanandgreenphilly.org/");

/* REPLACE WITH URL BELOW BEFORE PUSHING TO PRODUCTION
const siteUrl = new URL("https://cleanandgreenphilly.org/");
*/

export const metadata: Metadata = {
title: {
default: "Clean & Green Philly",
default: defaultTitle,
template: "%s - Clean & Green Philly",
},
description:
"Reduce the gun violence in Philadelphia by finding vacant properties to clean and green them.",
description: description,
icons: {
icon: "/favicon.ico",
},
metadataBase: siteUrl,
openGraph: {
type: "website",
url: "/",
title: defaultTitle,
description: description,
images: [
{
url: "/thumbnail.png",
width: 1200,
height: 630,
alt: "Clean & Green Philly",
},
],
siteName: "Clean & Green Philly",
},
};

export default function RootLayout({
Expand Down
38 changes: 38 additions & 0 deletions src/utilities/generateMetaData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { Metadata } from "next";
import { metadata as globalMetadata } from "../app/layout";

//imageUrl and imageAlt included to allow different images to be used for different pages in the future if desired

export function generateMetadata({
title,
description,
url,
imageUrl,
imageAlt,
}: {
title: string;
description?: string;
url: string;
imageUrl?: string;
imageAlt?: string;
}): Metadata {
return {
...globalMetadata,
title,
description,
openGraph: {
...globalMetadata.openGraph,
url,
title: `${title} - Clean & Green Philly`,
description,
images: [
{
url: imageUrl || "/thumbnail.png",
width: 1200,
height: 630,
alt: imageAlt || "Clean & Green Philly",
},
],
},
};
}

0 comments on commit 267ca36

Please sign in to comment.