[site/pages,#94]: fix titles
This commit is contained in:
parent
68646fe3b2
commit
13c2234a91
|
|
@ -7,7 +7,6 @@ import { ThemeProvider } from 'next-themes'
|
||||||
import '../styles/global.css'
|
import '../styles/global.css'
|
||||||
import siteConfig from '../config/siteConfig.js'
|
import siteConfig from '../config/siteConfig.js'
|
||||||
import Layout from '../components/Layout'
|
import Layout from '../components/Layout'
|
||||||
import MdxPage from '../components/MDX'
|
|
||||||
import * as gtag from '../lib/gtag'
|
import * as gtag from '../lib/gtag'
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }) {
|
function MyApp({ Component, pageProps }) {
|
||||||
|
|
@ -26,14 +25,15 @@ function MyApp({ Component, pageProps }) {
|
||||||
}
|
}
|
||||||
// end Google Analytics
|
// end Google Analytics
|
||||||
|
|
||||||
// console.log(Component)
|
const pageTitle = (
|
||||||
// const pageTitle = (
|
// check if markdown page
|
||||||
// router.pathname == "/"
|
Component.name == "Page"
|
||||||
// ? "home"
|
? pageProps.title ??
|
||||||
// // convert slug to title
|
// convert path to title
|
||||||
// : router.pathname.split("/").pop().replace(/-/g, " ")
|
pageProps._raw.flattenedPath.split("/").pop().replace(/-/g, " ")
|
||||||
// ) // capitalize first char of each word
|
: Component.name
|
||||||
// .replace(/(^\w{1})|(\s{1}\w{1})/g, (str) => str.toUpperCase());
|
) // capitalize first char of each word
|
||||||
|
.replace(/(^\w{1})|(\s{1}\w{1})/g, (str) => str.toUpperCase());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider attribute="class" defaultTheme="dark">
|
<ThemeProvider attribute="class" defaultTheme="dark">
|
||||||
|
|
@ -66,7 +66,7 @@ function MyApp({ Component, pageProps }) {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Layout title={""}>
|
<Layout title={pageTitle}>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</Layout>
|
</Layout>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue