-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ported SEO component and implemented metas in _document
- Loading branch information
1 parent
67ed296
commit 1996d01
Showing
2 changed files
with
42 additions
and
0 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,26 @@ | ||
import Head from 'next/head'; | ||
import { useRouter } from 'next/router'; | ||
import config from '../config'; | ||
|
||
type SEOProps = { | ||
pageTitle: string; | ||
}; | ||
|
||
const SEO = ({ pageTitle }: SEOProps) => { | ||
const { telescopeUrl } = config; | ||
const { pathname } = useRouter(); | ||
const currentUrl = `${telescopeUrl}${pathname}`; | ||
|
||
return ( | ||
<Head> | ||
<meta | ||
name="viewport" | ||
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover" | ||
/> | ||
<meta property="og:url" content={currentUrl} key="ogurl" /> | ||
<meta property="og:title" content={pageTitle} key="ogtitle" /> | ||
</Head> | ||
); | ||
}; | ||
|
||
export default SEO; |
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