Skip to content

Commit 7b95848

Browse files
authored
refactor: Use frontmatter title for page titles (#11223)
* refactor: use frontmatter title for page titles * use correct platform title
1 parent 6a08285 commit 7b95848

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

app/[[...path]]/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {isDeveloperDocs} from 'sentry-docs/isDeveloperDocs';
1919
import {getDevDocsFrontMatter, getDocsFrontMatter, getFileBySlug} from 'sentry-docs/mdx';
2020
import {mdxComponents} from 'sentry-docs/mdxComponents';
2121
import {setServerContext} from 'sentry-docs/serverContext';
22-
import {formatGuideOrPlatformTitle} from 'sentry-docs/utils';
2322

2423
export async function generateStaticParams() {
2524
const docs = await (isDeveloperDocs ? getDevDocsFrontMatter() : getDocsFrontMatter());
@@ -141,9 +140,7 @@ export async function generateMetadata({params}: MetadataProps): Promise<Metadat
141140
const guideOrPlatform = getCurrentPlatformOrGuide(rootNode, params.path);
142141
title =
143142
pageNode.frontmatter.title +
144-
(guideOrPlatform
145-
? ` | Sentry for ${formatGuideOrPlatformTitle(guideOrPlatform.name)}`
146-
: '');
143+
(guideOrPlatform ? ` | Sentry for ${guideOrPlatform.title}` : '');
147144
description = pageNode.frontmatter.description ?? '';
148145
}
149146
}

src/utils.ts

-36
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,6 @@ export const capitalize = (str: string) => {
1818
return str.charAt(0).toUpperCase() + str.slice(1);
1919
};
2020

21-
export const formatGuideOrPlatformTitle = (title: string) => {
22-
const lowerCase = title.toLowerCase();
23-
24-
switch (lowerCase) {
25-
case 'ios':
26-
return 'iOS';
27-
28-
case 'macos':
29-
return 'macOS';
30-
31-
case 'tvos':
32-
return 'tvOS';
33-
34-
case 'visionos':
35-
return 'visionOS';
36-
37-
case 'watchos':
38-
return 'watchOS';
39-
40-
case 'dotnet':
41-
return '.NET';
42-
43-
case 'kotlin-multiplatform':
44-
return 'Kotlin Multiplatform';
45-
46-
case 'php':
47-
return 'PHP';
48-
49-
case 'react-native':
50-
return 'React Native';
51-
52-
default:
53-
return capitalize(title);
54-
}
55-
};
56-
5721
export const uniqByReference = <T>(arr: T[]): T[] => Array.from(new Set(arr));
5822

5923
export const splitToChunks = <T>(numChunks: number, arr: T[]): T[][] => {

0 commit comments

Comments
 (0)