diff --git a/src/components/Layout.js b/src/components/Layout.js
index 5275147..9820328 100644
--- a/src/components/Layout.js
+++ b/src/components/Layout.js
@@ -1,17 +1,14 @@
import React from 'react'
import PropTypes from 'prop-types'
-import Helmet from 'react-helmet'
import classNames from 'classnames'
import Navbar from './Navbar'
import Footer from './Footer'
+import Meta from './Meta'
import '../css/main.scss'
const TemplateWrapper = ({ children, classes }) => (
-
+
{children}
diff --git a/src/components/Meta.js b/src/components/Meta.js
new file mode 100644
index 0000000..af93f6f
--- /dev/null
+++ b/src/components/Meta.js
@@ -0,0 +1,50 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { Helmet } from 'react-helmet';
+
+const Meta = ({ title, description, image, pathname, article }) => {
+ const imageUrl = image && image.localFile && image.localFile.url
+ const meta = {
+ title: title,
+ description: description,
+ image: imageUrl,
+ url: pathname,
+ }
+ return (
+
+ {meta.description && }
+ {meta.image && }
+ {meta.url && }
+ {(article ? true : null) && (
+
+ )}
+ {meta.title && }
+ {meta.description && (
+
+ )}
+ {meta.image && }
+
+ )
+}
+
+export default Meta
+
+Meta.propTypes = {
+ title: PropTypes.string,
+ description: PropTypes.string,
+ image: PropTypes.string,
+ pathname: PropTypes.string,
+ article: PropTypes.bool,
+}
+
+Meta.defaultProps = {
+ title: null,
+ description: null,
+ image: null,
+ pathname: null,
+ article: false,
+}
diff --git a/src/pages/404.js b/src/pages/404.js
index eff8d3c..3f5b65b 100644
--- a/src/pages/404.js
+++ b/src/pages/404.js
@@ -1,10 +1,10 @@
import React from 'react'
-import Helmet from 'react-helmet'
+import Meta from '../components/Meta'
import Layout from '../components/Layout'
const NotFoundPage = () => (
-
+
404: Denne siden er på grisefest
Lykke til videre.
diff --git a/src/pages/booking.js b/src/pages/booking.js
index 63648ca..9dd8dc2 100644
--- a/src/pages/booking.js
+++ b/src/pages/booking.js
@@ -1,7 +1,7 @@
import React from 'react'
-import Helmet from 'react-helmet'
import { graphql, useStaticQuery } from 'gatsby'
import Img from 'gatsby-image'
+import Meta from '../components/Meta'
import Layout from '../components/Layout'
import { VenueTemplate } from '../templates/venue'
@@ -65,7 +65,7 @@ export const BookingPage = () => {
return (
-
+
{title}
diff --git a/src/pages/foreningene.js b/src/pages/foreningene.js
index c805338..93de18b 100644
--- a/src/pages/foreningene.js
+++ b/src/pages/foreningene.js
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
-import Helmet from 'react-helmet'
import { graphql } from 'gatsby'
+import Meta from '../components/Meta'
import Layout from '../components/Layout'
import AssociationList from '../components/AssociationList'
@@ -12,7 +12,7 @@ export default class AssociationListPage extends React.Component {
return (
-
+
)
diff --git a/src/pages/profil.js b/src/pages/profil.js
index ed2535e..bdb720c 100644
--- a/src/pages/profil.js
+++ b/src/pages/profil.js
@@ -1,10 +1,10 @@
import React from 'react'
-import Helmet from 'react-helmet'
+import Meta from '../components/Meta'
import Layout from '../components/Layout'
const DesignManual = () => (
-
+
Profil
Hei
diff --git a/src/pages/program.js b/src/pages/program.js
index 02b9500..16d8c70 100644
--- a/src/pages/program.js
+++ b/src/pages/program.js
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
-import Helmet from 'react-helmet'
import { graphql } from 'gatsby'
+import Meta from '../components/Meta'
import Layout from '../components/Layout'
import EventList from '../components/EventList'
@@ -12,7 +12,7 @@ export default class EventProgram extends React.Component {
return (
-
+
) : (
-
- )}
+
+ )}
)}
{homepage && (
@@ -51,6 +52,10 @@ const AssociationPage = ({ data }) => {
return (