Skip to content

Commit 8b3fd1b

Browse files
committed
Add "Building a Better Git" to title of the frontpage
1 parent e81da4f commit 8b3fd1b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/pages/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Heading from "@/components/layout/Heading";
1717
import { makeSitemapMeta } from "@/utils/meta/sitemap";
1818

1919
import { sendCTAEvent } from "@/api/analytics";
20+
import { makeOgMeta } from "@/utils/meta/opengraph";
2021

2122
const logoAnim = {
2223
initial: {
@@ -31,12 +32,12 @@ const logoAnim = {
3132
}
3233
} as const;
3334

34-
const FrontPage: Page = ({ }) => {
35+
const FrontPage: Page = ({ pathname }) => {
3536

3637
return (
3738
<>
3839
<Head>
39-
<title>Commit Rocket</title>
40+
{makeOgMeta({ title: "Building a Better Git", reverseTitle: true, pathname })}
4041
{makeSitemapMeta({ priority: 1 })}
4142
</Head>
4243
<main aria-labelledby="hero-title" className="flex flex-col flex-1 w-full gap-32 pb-8 max-w-7xl">

src/utils/meta/opengraph/base.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ const computeImage = (image?: string | StaticImageData, imageAlt?: string) => {
4444
} satisfies OgImage;
4545
};
4646

47-
export const makeOgMeta = (allProps: Partial<OgBase>) => {
47+
export const makeOgMeta = ({ reverseTitle, ...allProps }: Partial<OgBase> & { reverseTitle?: boolean; }) => {
4848
const { localeAlternate, pathname, url, image, title, ...props } = Object.assign({}, DEFAULT_OG, allProps);
4949

50-
const computedTitle = title === DEFAULT_OG.title ? title : `${title} - ${DEFAULT_OG.title}`;
50+
const firstTitlePart = reverseTitle ? DEFAULT_OG.title : title;
51+
const secondTitlePart = reverseTitle ? title : DEFAULT_OG.title;
52+
53+
const computedTitle = title === DEFAULT_OG.title ? title : `${firstTitlePart} - ${secondTitlePart}`;
5154
const computedUrl = pathname ? `${process.env.NEXT_PUBLIC_FRONTEND_URL}${pathname}` : url;
5255
const computedImage = computeImage(image);
5356

0 commit comments

Comments
 (0)