Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ ui:
font_style: "normal"
font_weight: 700
name: "ubuntu-v20-latin-700"
footer:
links:
- title: "Impressum"
url: "https://www.hbz-nrw.de/impressum"
target: "_blank"
rel: "noopener noreferrer"
- title: "Datenschutz"
url: "https://www.hbz-nrw.de/datenschutz"
target: "_blank"
rel: "noopener noreferrer"
- title: "© SkoHub"
url: "https://skohub.io"
target: "_blank"
rel: "noopener noreferrer"
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
colors: config.colors,
logo: config.logo,
fonts: config.fonts,
footer: config.footer,
searchableAttributes: config.searchableAttributes,
customDomain: config.customDomain,
failOnValidation: config.failOnValidation,
Expand Down
1 change: 1 addition & 0 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function loadConfig(configFile, defaultFile) {
tokenizer: userConfig.tokenizer || defaults.tokenizer,
colors: userConfig.ui.colors || defaults.ui.colors,
fonts: userConfig.ui.fonts || defaults.ui.fonts,
footer: userConfig.ui.footer || defaults.ui.footer,
searchableAttributes:
userConfig.searchableAttributes || defaults.searchableAttributes,
customDomain: userConfig.custom_domain || "",
Expand Down
36 changes: 17 additions & 19 deletions src/components/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { getConfigAndConceptSchemes } from "../hooks/configAndConceptSchemes"
const Footer = () => {
const { config } = getConfigAndConceptSchemes()

//console.log("CONFIG:", config)

const style = css`
background: ${config.colors.skoHubMiddleColor};
color: ${config.colors.skoHubWhite};
Expand Down Expand Up @@ -46,6 +48,10 @@ const Footer = () => {
}
}
`

// Get links from config.yaml, if available
const links = config?.footer?.links || []

return (
<footer css={style}>
<div className="footerContent">
Expand All @@ -61,25 +67,17 @@ const Footer = () => {
</a>
</li>
)}
<li className="push-right">
<a
href="https://www.hbz-nrw.de/impressum"
target="_blank"
rel="noopener noreferrer"
>
Impressum
</a>
</li>
<li>
&copy;{" "}
<a
href="https://skohub.io"
target="_blank"
rel="noopener noreferrer"
>
SkoHub
</a>
</li>
{links.map((link, idx) => (
<li key={idx} className={idx === 0 ? "push-right" : ""}>
<a
href={link.url}
target={link.target || undefined}
rel={link.rel || undefined}
>
{link.title}
</a>
</li>
))}
</ul>
</div>
</footer>
Expand Down
8 changes: 8 additions & 0 deletions src/hooks/configAndConceptSchemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ export const getConfigAndConceptSchemes = () => {
name
}
}
footer {
links {
title
url
target
rel
}
}
searchableAttributes
customDomain
failOnValidation
Expand Down
22 changes: 22 additions & 0 deletions test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ describe("Config Parsing", () => {
name: "alegreya-sans-v24-latin-700",
},
},
footer: {
links: [
{
title: "Impressum",
url: "https://www.hbz-nrw.de/impressum",
target: "_blank",
rel: "noopener noreferrer",
},
{
title: "Datenschutz",
url: "https://www.hbz-nrw.de/datenschutz",
target: "_blank",
rel: "noopener noreferrer",
},
{
title: "© SkoHub",
url: "https://skohub.io",
target: "_blank",
rel: "noopener noreferrer",
},
],
},
})
})

Expand Down
14 changes: 14 additions & 0 deletions test/data/config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,17 @@ ui:
font_style: "normal"
font_weight: 700
name: "ubuntu-v20-latin-700"
footer:
links:
- title: "Impressum"
url: "https://www.hbz-nrw.de/impressum"
target: "_blank"
rel: "noopener noreferrer"
- title: "Datenschutz"
url: "https://www.hbz-nrw.de/datenschutz"
target: "_blank"
rel: "noopener noreferrer"
- title: "© SkoHub"
url: "https://skohub.io"
target: "_blank"
rel: "noopener noreferrer"
14 changes: 14 additions & 0 deletions test/data/config/config.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@ ui:
font_style: "normal"
font_weight: 700
name: "alegreya-sans-v24-latin-700"
footer:
links:
- title: "Impressum"
url: "https://www.hbz-nrw.de/impressum"
target: "_blank"
rel: "noopener noreferrer"
- title: "Datenschutz"
url: "https://www.hbz-nrw.de/datenschutz"
target: "_blank"
rel: "noopener noreferrer"
- title: "© SkoHub"
url: "https://skohub.io"
target: "_blank"
rel: "noopener noreferrer"