Skip to content

Commit 4c2bf98

Browse files
committed
Make footer links configurable #29
1 parent c778e8a commit 4c2bf98

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

config.default.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,17 @@ ui:
3737
font_style: "normal"
3838
font_weight: 700
3939
name: "ubuntu-v20-latin-700"
40+
footer:
41+
links:
42+
- title: "Impressum"
43+
url: "https://www.hbz-nrw.de/impressum"
44+
target: "_blank"
45+
rel: "noopener noreferrer"
46+
- title: "Datenschutz"
47+
url: "https://www.hbz-nrw.de/datenschutz"
48+
target: "_blank"
49+
rel: "noopener noreferrer"
50+
- title: "SkoHub"
51+
url: "https://skohub.io"
52+
target: "_blank"
53+
rel: "noopener noreferrer"

gatsby-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
colors: config.colors,
1313
logo: config.logo,
1414
fonts: config.fonts,
15+
footer: config.footer,
1516
searchableAttributes: config.searchableAttributes,
1617
customDomain: config.customDomain,
1718
failOnValidation: config.failOnValidation,

src/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ function loadConfig(configFile, defaultFile) {
139139
tokenizer: userConfig.tokenizer || defaults.tokenizer,
140140
colors: userConfig.ui.colors || defaults.ui.colors,
141141
fonts: userConfig.ui.fonts || defaults.ui.fonts,
142+
footer: userConfig.ui.footer || defaults.ui.footer,
142143
searchableAttributes:
143144
userConfig.searchableAttributes || defaults.searchableAttributes,
144145
customDomain: userConfig.custom_domain || "",

src/components/footer.jsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { getConfigAndConceptSchemes } from "../hooks/configAndConceptSchemes"
77
const Footer = () => {
88
const { config } = getConfigAndConceptSchemes()
99

10+
//console.log("CONFIG:", config)
11+
1012
const style = css`
1113
background: ${config.colors.skoHubMiddleColor};
1214
color: ${config.colors.skoHubWhite};
@@ -46,6 +48,10 @@ const Footer = () => {
4648
}
4749
}
4850
`
51+
52+
// Get links from config.yaml, if available
53+
const links = config?.footer?.links || []
54+
4955
return (
5056
<footer css={style}>
5157
<div className="footerContent">
@@ -61,25 +67,17 @@ const Footer = () => {
6167
</a>
6268
</li>
6369
)}
64-
<li className="push-right">
65-
<a
66-
href="https://www.hbz-nrw.de/impressum"
67-
target="_blank"
68-
rel="noopener noreferrer"
69-
>
70-
Impressum
71-
</a>
72-
</li>
73-
<li>
74-
&copy;{" "}
75-
<a
76-
href="https://skohub.io"
77-
target="_blank"
78-
rel="noopener noreferrer"
79-
>
80-
SkoHub
81-
</a>
82-
</li>
70+
{links.map((link, idx) => (
71+
<li key={idx} className={idx === 0 ? "push-right" : ""}>
72+
<a
73+
href={link.url}
74+
target={link.target || undefined}
75+
rel={link.rel || undefined}
76+
>
77+
{link.title}
78+
</a>
79+
</li>
80+
))}
8381
</ul>
8482
</div>
8583
</footer>

src/hooks/configAndConceptSchemes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ export const getConfigAndConceptSchemes = () => {
7474
name
7575
}
7676
}
77+
footer {
78+
links {
79+
title
80+
url
81+
target
82+
rel
83+
}
84+
}
7785
searchableAttributes
7886
customDomain
7987
failOnValidation

0 commit comments

Comments
 (0)