mirror of
				https://github.com/mastermindzh/rickvanlieshout.com
				synced 2025-10-31 16:49:49 +01:00 
			
		
		
		
	refactor(starter): upgrade to new version of gatsby
This commit is contained in:
		
							
								
								
									
										38
									
								
								src/components/Layout/Layout.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/components/Layout/Layout.tsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| import React from "react"; | ||||
| import Helmet from "react-helmet"; | ||||
|  | ||||
| import { useSiteMetadata } from "@/hooks"; | ||||
|  | ||||
| import styles from "./Layout.module.scss"; | ||||
|  | ||||
| interface Props { | ||||
|   title: string; | ||||
|   description?: string; | ||||
|   socialImage?: string; | ||||
|   children: React.ReactNode; | ||||
| } | ||||
|  | ||||
| const Layout: React.FC<Props> = ({ children, title, description, socialImage = "" }: Props) => { | ||||
|   const { author, url } = useSiteMetadata(); | ||||
|   const metaImage = socialImage || author.photo; | ||||
|   const metaImageUrl = url + metaImage; | ||||
|  | ||||
|   return ( | ||||
|     <div className={styles.layout}> | ||||
|       <Helmet> | ||||
|         <html lang="en" /> | ||||
|         <title>{title}</title> | ||||
|         <meta name="description" content={description} /> | ||||
|         <meta property="og:site_name" content={title} /> | ||||
|         <meta property="og:image" content={metaImageUrl} /> | ||||
|         <meta name="twitter:card" content="summary" /> | ||||
|         <meta name="twitter:title" content={title} /> | ||||
|         <meta name="twitter:description" content={description} /> | ||||
|         <meta name="twitter:image" content={metaImageUrl} /> | ||||
|       </Helmet> | ||||
|       {children} | ||||
|     </div> | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| export default Layout; | ||||
		Reference in New Issue
	
	Block a user