add edit link to sites

This commit is contained in:
neri 2019-12-14 17:10:54 +01:00
parent 00e71ed59e
commit d52c589ed6
10 changed files with 27 additions and 4 deletions

View File

@ -2,9 +2,19 @@ import React from "react"
import footerStyles from "./footer.module.css" import footerStyles from "./footer.module.css"
import { Link } from "gatsby" import { Link } from "gatsby"
export default () => ( export default ({ editLink }) => (
<div className={footerStyles.footer}> <div className={footerStyles.footer}>
<div className={footerStyles.footerContent}> <div className={footerStyles.footerContent}>
{editLink ? (
<a
className={footerStyles.footerItem}
href={editLink}
target="_blank"
rel="noopener noreferrer"
>
Seite bearbeiten
</a>
) : null}
<Link className={footerStyles.footerItem} to="/impressum/"> <Link className={footerStyles.footerItem} to="/impressum/">
Impressum Impressum
</Link> </Link>

View File

@ -3,10 +3,10 @@ import Nav from "../components/nav"
import Footer from "../components/footer" import Footer from "../components/footer"
import layoutStyles from "./layout.module.css" import layoutStyles from "./layout.module.css"
export default ({ children }) => ( export default ({ editLink, children }) => (
<> <>
<Nav /> <Nav />
<div className={layoutStyles.layout}>{children}</div> <div className={layoutStyles.layout}>{children}</div>
<Footer /> <Footer editLink={editLink} />
</> </>
) )

View File

@ -1,6 +1,7 @@
--- ---
path: "/datenschutz" path: "/datenschutz"
title: "Datenschutzerklärung" title: "Datenschutzerklärung"
edit: "datenschutz.mdx"
--- ---
## Datenschutzerklärung ## Datenschutzerklärung

View File

@ -1,6 +1,7 @@
--- ---
path: "/events" path: "/events"
title: "Events" title: "Events"
edit: "events.mdx"
--- ---
## Events ## Events

View File

@ -1,6 +1,7 @@
--- ---
path: "/" path: "/"
title: "Home" title: "Home"
edit: "home.mdx"
--- ---
## Wer wir sind ## Wer wir sind

View File

@ -1,6 +1,7 @@
--- ---
path: "/impressum" path: "/impressum"
title: "Impressum" title: "Impressum"
edit: "impressum.mdx"
--- ---
## Impressum ## Impressum

View File

@ -1,6 +1,7 @@
--- ---
path: "/kontakt" path: "/kontakt"
title: "Kontakt" title: "Kontakt"
edit: "kontakt.mdx"
--- ---
## Kontakt ## Kontakt

View File

@ -1,6 +1,7 @@
--- ---
path: "/treff" path: "/treff"
title: "Zeiten & Location" title: "Zeiten & Location"
edit: "treff.mdx"
--- ---
import RoomState from "../components/roomState.js" import RoomState from "../components/roomState.js"

View File

@ -1,6 +1,7 @@
--- ---
path: "/verein" path: "/verein"
title: "Verein" title: "Verein"
edit: "verein.mdx"
--- ---
## Verein ## Verein

View File

@ -3,6 +3,9 @@ import { graphql } from "gatsby"
import Layout from "../components/layout" import Layout from "../components/layout"
import { MDXRenderer } from "gatsby-plugin-mdx" import { MDXRenderer } from "gatsby-plugin-mdx"
const ide =
"https://repos.ctdo.de/-/ide/project/neri/ctdo-hompage/edit/master/-/src/markdown-pages/"
export default function Template({ export default function Template({
data, // this prop will be injected by the GraphQL query below. data, // this prop will be injected by the GraphQL query below.
}) { }) {
@ -13,8 +16,10 @@ export default function Template({
document.title = frontmatter.title document.title = frontmatter.title
}, [frontmatter.title]) }, [frontmatter.title])
const editLink = frontmatter.edit ? ide + frontmatter.edit : null
return ( return (
<Layout> <Layout editLink={editLink}>
<MDXRenderer>{body}</MDXRenderer> <MDXRenderer>{body}</MDXRenderer>
</Layout> </Layout>
) )
@ -26,6 +31,7 @@ export const pageQuery = graphql`
body body
frontmatter { frontmatter {
title title
edit
} }
} }
} }