Skip to content

Commit 9e17a45

Browse files
committed
navigation should not be defined in config.toml
it moves to content/navigation.yml advantage: changes affect immediate reload when previewing
1 parent 9516a74 commit 9e17a45

File tree

3 files changed

+85
-52
lines changed

3 files changed

+85
-52
lines changed

config.toml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -39,47 +39,3 @@ twitter_image = "https://raw.githubusercontent.com/coderefinery/coderefinery-art
3939
twitter_image_alt = "CodeRefinery. Teaching good-enough practices for comutational research. Workshops as open as your science should be."
4040

4141
plausible = { src = "https://plausible.cs.aalto.fi/js/script.js", domain = "coderefinery.org", github_ref = "refs/heads/main" }
42-
43-
navigation = [
44-
{ name = "Home", target = "/" },
45-
{ name = "Lessons", target = "/lessons/", items = [
46-
{ name = "CodeRefinery lessons", target = "/lessons/" },
47-
{ name = "Reusing", target = "/lessons/reusing/" },
48-
{ name = "Other lessons we recommend", target = "/lessons/other/" },
49-
] },
50-
{ name = "Workshops and events", target = "/workshops/", items = [
51-
{ name = "Upcoming and recent", target = "/workshops/upcoming/" },
52-
{ name = "Past", target = "/workshops/past/" },
53-
{ name = "The CodeRefinery teaching style", target = "/workshops/teaching-style/" },
54-
{ name = "Request or run your own", target = "/workshops/request/" },
55-
] },
56-
{ name = "Tasks/roadmap", target = "/tasks/" },
57-
{ name = "Join", target = "/join/", items = [
58-
{ name = "Chat", target = "/join/chat/" },
59-
{ name = "For individuals", target = "/join/individuals/" },
60-
{ name = "For staff", target = "/join/staff/" },
61-
{ name = "For organizations", target = "/join/organizations/" },
62-
{ name = "Community teaching training", target = "/join/community-teaching-training/" },
63-
{ name = "Meetings", target = "/join/meetings/" },
64-
{ name = "Calendars", target = "/calendars/" },
65-
{ name = "The CodeRefinery community", target = "/about/contributors/" },
66-
{ name = "Code of conduct", target = "/about/code-of-conduct/" },
67-
] },
68-
{ name = "About", target = "/about/", items = [
69-
{ name = "Project", target = "/about/project/" },
70-
{ name = "History", target = "/about/history/" },
71-
{ name = "The CodeRefinery community", target = "/about/contributors/" },
72-
{ name = "Partners and sponsors", target = "/about/partners/" },
73-
{ name = "Impact", target = "/about/impact/" },
74-
{ name = "Statistics", target = "/about/statistics/" },
75-
{ name = "Presentations", target = "/about/presentations/" },
76-
{ name = "Articles and reports", target = "/about/reports/" },
77-
{ name = "Newsletter", target = "/about/newsletter/" },
78-
{ name = "Operations manuals (external link)", target = "https://coderefinery.github.io/manuals/" },
79-
{ name = "Contact", target = "/about/contact/" },
80-
] },
81-
{ name = "News/blog", target = "/blog/" },
82-
{ name = "GitLab repository", target = "/repository/" },
83-
]
84-
85-
# search_engine_exclude = true

content/navigation.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
navigation:
2+
- name: Home
3+
target: /
4+
- name: Lessons
5+
target: /lessons/
6+
items:
7+
- name: CodeRefinery lessons
8+
target: /lessons/
9+
- name: Reusing
10+
target: /lessons/reusing/
11+
- name: Other lessons we recommend
12+
target: /lessons/other/
13+
- name: Workshops and events
14+
target: /workshops/
15+
items:
16+
- name: Upcoming and recent
17+
target: /workshops/upcoming/
18+
- name: Past
19+
target: /workshops/past/
20+
- name: The CodeRefinery teaching style
21+
target: /workshops/teaching-style/
22+
- name: Request or run your own
23+
target: /workshops/request/
24+
- name: Tasks/roadmap
25+
target: /tasks/
26+
- name: Join
27+
target: /join/
28+
items:
29+
- name: Chat
30+
target: /join/chat/
31+
- name: For individuals
32+
target: /join/individuals/
33+
- name: For staff
34+
target: /join/staff/
35+
- name: For organizations
36+
target: /join/organizations/
37+
- name: Community teaching training
38+
target: /join/community-teaching-training/
39+
- name: Meetings
40+
target: /join/meetings/
41+
- name: Calendars
42+
target: /calendars/
43+
- name: The CodeRefinery community
44+
target: /about/contributors/
45+
- name: Code of conduct
46+
target: /about/code-of-conduct/
47+
- name: About
48+
target: /about/
49+
items:
50+
- name: Project
51+
target: /about/project/
52+
- name: History
53+
target: /about/history/
54+
- name: The CodeRefinery community
55+
target: /about/contributors/
56+
- name: Partners and sponsors
57+
target: /about/partners/
58+
- name: Impact
59+
target: /about/impact/
60+
- name: Statistics
61+
target: /about/statistics/
62+
- name: Presentations
63+
target: /about/presentations/
64+
- name: Articles and reports
65+
target: /about/reports/
66+
- name: Newsletter
67+
target: /about/newsletter/
68+
- name: Operations manuals (external link)
69+
target: https://coderefinery.github.io/manuals/
70+
- name: Contact
71+
target: /about/contact/
72+
- name: News/blog
73+
target: /blog/
74+
- name: GitLab repository
75+
target: /repository/

templates/navigation-logic.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
{% for item in config.extra.navigation %}
1+
{% set data = load_data(path="content/navigation.yml") %}
2+
3+
{% for link in data.navigation %}
24
<li>
35

46
{% set href = "#" %}
5-
{% if item.target is defined %}
6-
{% if item.target is starting_with("http") %}
7-
{% set href = item.target %}
7+
{% if link.target is defined %}
8+
{% if link.target is starting_with("http") %}
9+
{% set href = link.target %}
810
{% else %}
9-
{% set href = get_url(path=item.target) %}
11+
{% set href = get_url(path=link.target) %}
1012
{% endif %}
1113
{% endif %}
1214

13-
{% set contains_dropdown = item.items is defined %}
15+
{% set contains_dropdown = link.items is defined %}
1416

1517
<a href="{{ href }}">
16-
{{ item.name }}
18+
{{ link.name }}
1719
{% if contains_dropdown %}
1820
<span uk-navbar-parent-icon></span>
1921
{% endif %}
@@ -24,7 +26,7 @@
2426
<div class="uk-navbar-dropdown">
2527
{% endif %}
2628
<ul class="uk-nav uk-navbar-dropdown-nav">
27-
{% for subitem in item.items %}
29+
{% for subitem in link.items %}
2830
<li>
2931
{% if subitem.target is starting_with("http") %}
3032
<a href="{{ subitem.target }}" target="_blank">{{ subitem.name }}</a>

0 commit comments

Comments
 (0)