-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial setup for migration to Next app instead of pages
- Loading branch information
1 parent
58bdc24
commit 7ffdcd9
Showing
7 changed files
with
175 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles' | ||
import CssBaseline from '@mui/material/CssBaseline' | ||
import theme from '@Modules/theme' | ||
import '@Styles/globals.css' | ||
import { SpeedInsights } from '@vercel/speed-insights/next' | ||
|
||
import { StateProvider } from '@Modules/store' | ||
import { GoogleAnalytics } from '@Components/GoogleAnalytics' | ||
import SearchAppBar from '@Components/SearchAppBar/SearchAppBar' | ||
import Footer from '@Components/Footer' | ||
const Layout = ({ children }) => ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
minHeight: '100vh', | ||
flexDirection: 'column' | ||
}} | ||
> | ||
{children} | ||
</div> | ||
) | ||
|
||
const Content = ({ children }) => { | ||
return <div style={{ padding: '1rem' }}>{children}</div> | ||
} | ||
|
||
export const AppBody = ({ children }: { children: React.ReactNode }) => { | ||
return ( | ||
<> | ||
<GoogleAnalytics /> | ||
<StyledEngineProvider injectFirst> | ||
<ThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
<StateProvider> | ||
<Layout> | ||
<SearchAppBar /> | ||
<Content>{children}</Content> | ||
<Footer /> | ||
<SpeedInsights /> | ||
</Layout> | ||
</StateProvider> | ||
</ThemeProvider> | ||
</StyledEngineProvider> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import '@Styles/globals.css' | ||
import { AppBody } from '@App/AppBody' | ||
import { siteMetadata } from '@Modules/metadata' | ||
|
||
export const metadata = siteMetadata | ||
|
||
export default function RootLayout({ | ||
children | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
return ( | ||
<html lang="en"> | ||
<body> | ||
<AppBody>{children}</AppBody> | ||
</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use client'; | ||
|
||
import ReactGA from 'react-ga' | ||
import { useEffect } from 'react' | ||
|
||
export const initGA = () => { | ||
ReactGA.initialize('UA-35322373-3', { debug: false }) | ||
} | ||
|
||
export const logPageView = () => { | ||
ReactGA.set({ page: window.location.pathname }) | ||
ReactGA.pageview(window.location.pathname) | ||
} | ||
|
||
export const GoogleAnalytics = () => { | ||
useEffect(() => { | ||
if (!window.GA_INITIALIZED) { | ||
initGA() | ||
window.GA_INITIALIZED = true | ||
} | ||
logPageView() | ||
}) | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Metadata } from 'next' | ||
|
||
const SITE_ROOT = 'https://bluprince13.com' | ||
const title = 'bluprince13' | ||
const description = 'Full-stack web developer' | ||
|
||
export const siteMetadata: Metadata = { | ||
title, | ||
description, | ||
alternates: { | ||
canonical: SITE_ROOT, | ||
// TODO: Support multiple RSS feeds | ||
// https://github.com/vercel/next.js/discussions/62365 | ||
types: { | ||
'application/rss+xml': `${SITE_ROOT}/feed.xml` | ||
} | ||
}, | ||
openGraph: { | ||
type: 'website', | ||
locale: 'en_GB', | ||
url: SITE_ROOT, | ||
title, | ||
description, | ||
images: [ | ||
{ | ||
url: `${SITE_ROOT}/photo.jpg`, | ||
alt: title | ||
} | ||
] | ||
}, | ||
twitter: { | ||
creator: '@vipinajayakumar', | ||
site: '@vipinajayakumar', | ||
card: 'summary_large_image' | ||
} | ||
} | ||
|
||
interface MetadataProps { | ||
pageTitle: string | ||
description: string | ||
path: string | ||
bannerPath?: string | ||
} | ||
|
||
export const generateMetadata = ({ | ||
pageTitle, | ||
description, | ||
path, | ||
bannerPath | ||
}: MetadataProps): Metadata => { | ||
const title = `${pageTitle} - Vipin Ajayakumar` | ||
const url = `${SITE_ROOT}${path}` | ||
const featuredImage = bannerPath ? `${SITE_ROOT}${bannerPath}` : null | ||
|
||
return { | ||
title, | ||
description, | ||
openGraph: { | ||
url, | ||
title, | ||
description, | ||
images: featuredImage | ||
? [ | ||
{ | ||
url: featuredImage, | ||
alt: title | ||
} | ||
] | ||
: [] | ||
}, | ||
twitter: { | ||
card: 'summary_large_image', | ||
title, | ||
description, | ||
images: featuredImage ? [featuredImage] : [] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7ffdcd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
bluprince13-next – ./
bluprince13.com
bluprince13-next-git-main-vipin-ajayakumars-projects.vercel.app
bluprince13-next-vipin-ajayakumars-projects.vercel.app
www.bluprince13.com
bluprince13-next.vercel.app