fix page building and linking
This commit is contained in:
parent
23b0a146eb
commit
bf71ed2077
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
resolve: `gatsby-source-filesystem`,
|
||||
options: {
|
||||
name: `pages`,
|
||||
path: `${__dirname}/src/pages`,
|
||||
path: `${__dirname}/src/webpages`,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import React from "react"
|
||||
import navStyles from "./nav.module.css"
|
||||
import { Link } from "gatsby"
|
||||
import React from 'react'
|
||||
import navStyles from './nav.module.css'
|
||||
import { Link } from 'gatsby'
|
||||
|
||||
let pages = [
|
||||
["home", "/", navStyles.desktopOnly],
|
||||
["zeiten & location", "treff", ""],
|
||||
["events", "events", ""],
|
||||
["über uns", "about", ""],
|
||||
["kontakt", "kontakt", ""],
|
||||
["verein", "verein", ""],
|
||||
["supporte uns", "support", ""],
|
||||
['home', '/', navStyles.desktopOnly],
|
||||
['zeiten & location', '/treff', ''],
|
||||
['events', '/events', ''],
|
||||
['über uns', '/about', ''],
|
||||
['kontakt', '/kontakt', ''],
|
||||
['verein', '/verein', ''],
|
||||
['supporte uns', '/support', ''],
|
||||
]
|
||||
|
||||
export default ({ path }) => {
|
||||
// nav items should always be active in the staticly generated html
|
||||
const isSSR = typeof window === "undefined"
|
||||
const isSSR = typeof window === 'undefined'
|
||||
const activeClasses = link =>
|
||||
isSSR && path === "/" + link ? " " + navStyles.navItemActive : ""
|
||||
isSSR && path === link ? ' ' + navStyles.navItemActive : ''
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -36,9 +36,9 @@ export default ({ path }) => {
|
|||
{pages.map(([title, link, device]) => (
|
||||
<Link
|
||||
key={title}
|
||||
className={navStyles.navItem + activeClasses(link) + " " + device}
|
||||
className={navStyles.navItem + activeClasses(link) + ' ' + device}
|
||||
activeClassName={navStyles.navItemActive}
|
||||
to={`/${link}`}
|
||||
to={`${link}`}
|
||||
>
|
||||
{title}
|
||||
</Link>
|
||||
|
|
Loading…
Reference in New Issue