Skip to content

Commit 82b3bb2

Browse files
fix page title for preview
1 parent 335ff74 commit 82b3bb2

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

docs-v2/theme.config.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,7 @@ import DocSearch from "./components/DocSearch";
1212
const config: DocsThemeConfig = {
1313
head: function Head() {
1414
const router = useRouter()
15-
const { frontMatter } = useConfig()
16-
17-
let pageTitle = frontMatter?.title;
18-
// If no title in front matter, derive it from the URL
19-
if (!pageTitle) {
20-
const segments = router.asPath.replace(/\/$/, "").split("/");
21-
pageTitle = segments[segments.length - 1];
22-
// Replace dashes/underscores with spaces and capitalize each first letter
23-
pageTitle = pageTitle.replace(/[-_]/g, " ");
24-
pageTitle = pageTitle.replace(/\b\w/g, (char) => char.toUpperCase());
25-
}
15+
const { title } = useConfig()
2616

2717
return (
2818
<>
@@ -31,7 +21,7 @@ const config: DocsThemeConfig = {
3121
? ""
3222
: router.route}`} />}
3323
<link rel="icon" href="/docs/favicon.ico" />
34-
<meta property="og:title" content={`${pageTitle} — Pipedream`} />
24+
<meta property="og:title" content={`${title} — Pipedream`} />
3525
</>
3626
)
3727
},

0 commit comments

Comments
 (0)