From 0379943cdc6ae3ddef92be38778345c96967332d Mon Sep 17 00:00:00 2001 From: Markus Tacker Date: Tue, 31 May 2022 23:48:40 +0200 Subject: [PATCH] fix: configure domain --- gatsby-config.ts | 7 ++-- src/components/head.tsx | 15 +++++---- src/pages/404.tsx | 74 ++++++++++++++++++++--------------------- src/pages/index.tsx | 31 +++++++++++++++-- 4 files changed, 80 insertions(+), 47 deletions(-) diff --git a/gatsby-config.ts b/gatsby-config.ts index cd62dc8..975ae85 100644 --- a/gatsby-config.ts +++ b/gatsby-config.ts @@ -1,9 +1,12 @@ import type { GatsbyConfig } from 'gatsby' +const domain = process.env.DOMAIN ?? 'volt.camp' + const config: GatsbyConfig = { siteMetadata: { - title: `volt.camp`, - siteUrl: `https://volt.camp`, + title: domain, + siteUrl: `https://${domain}`, + description: 'The future of eco-friendly van camping is electric.' }, plugins: [ { diff --git a/src/components/head.tsx b/src/components/head.tsx index 1012b60..9401800 100644 --- a/src/components/head.tsx +++ b/src/components/head.tsx @@ -3,16 +3,19 @@ import { Helmet } from 'react-helmet' import '../../node_modules/normalize.css/normalize.css' -export const Head = () => { +export const Head = ({ + title, + description, +}: { + title: string + description: string +}) => { const linkRef = React.useRef(null) return ( - volt.camp - + {title} + { - return ( -
- Not found -

Page not found

-

- Sorry{" "} - - 😔 - {" "} - we couldn’t find what you were looking for. -
- {process.env.NODE_ENV === "development" ? ( - <> -
- Try creating a page in src/pages/. -
- - ) : null} -
- Go home. -

-
- ) + return ( +
+ Not found +

Page not found

+

+ Sorry{' '} + + 😔 + {' '} + we couldn’t find what you were looking for. +
+ {process.env.NODE_ENV === 'development' ? ( + <> +
+ Try creating a page in src/pages/. +
+ + ) : null} +
+ Go home. +

+
+ ) } export default NotFoundPage diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5963126..8f83ac4 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,3 +1,4 @@ +import { graphql, PageProps } from 'gatsby' import * as React from 'react' import { ArticleTile } from '../components/ArticleTile' import { Box } from '../components/box' @@ -7,10 +8,25 @@ import { Header } from '../components/header' import Logo from '../images/logo.svg' import * as indexStyles from './index.module.css' -const IndexPage = () => { +const IndexPage: React.FunctionComponent< + PageProps<{ + site: { + siteMetadata: { + title: string + description: string + } + } + }> +> = ({ + data: { + site: { + siteMetadata: { title, description }, + }, + }, +}) => { return ( <> - +
@@ -43,3 +59,14 @@ const IndexPage = () => { } export default IndexPage + +export const query = graphql` + { + site { + siteMetadata { + title + description + } + } + } +`