File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,24 @@ const config: DocsThemeConfig = {
1414 const router = useRouter ( )
1515 const { frontMatter } = useConfig ( )
1616
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+ }
26+
1727 return (
1828 < >
1929 < meta name = "description" content = "Workflow automation for developers" />
2030 { router && < link rel = "canonical" href = { `https://pipedream.com/docs${ router . route === "/"
2131 ? ""
2232 : router . route } `} /> }
2333 < link rel = "icon" href = "/docs/favicon.ico" />
24- < meta property = "og:title" content = { `${ frontMatter ?. title || "" } — Pipedream` } />
34+ < meta property = "og:title" content = { `${ pageTitle } — Pipedream` } />
2535 </ >
2636 )
2737 } ,
You can’t perform that action at this time.
0 commit comments