Skip to content

Commit ffa03c2

Browse files
committed
update menu structure
1 parent 2bdad6f commit ffa03c2

4 files changed

Lines changed: 590 additions & 99 deletions

File tree

config/_default/menus.en.yaml

Lines changed: 62 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,92 @@
11
main:
2-
- name: Learn
3-
URL: learn
2+
- name: About
3+
URL: about
44
weight: 1
5-
identifier: learn
6-
- name: Books
7-
parent: learn
8-
URL: learn/books
5+
identifier: about
6+
- name: Who We Are
7+
URL: about
8+
parent: about
9+
weight: 1
10+
- name: Board & Governance
11+
URL: about/board
12+
parent: about
913
weight: 2
10-
- name: Learning Path
11-
parent: learn
12-
URL: learn/learning-path
14+
- name: Members
15+
URL: about/members
16+
parent: about
1317
weight: 3
18+
- name: Code of Conduct
19+
URL: about/codeofconduct
20+
parent: about
21+
weight: 4
22+
- name: Contact Us
23+
URL: about/contact
24+
parent: about
25+
weight: 5
26+
- name: Projects
27+
URL: learn/patterns
28+
weight: 2
29+
identifier: projects
1430
- name: Patterns
15-
parent: learn
1631
URL: learn/patterns
17-
weight: 4
32+
parent: projects
33+
weight: 1
1834
- name: Research
19-
parent: learn
2035
URL: learn/research
21-
weight: 5
22-
- name: Videos
23-
parent: learn
24-
URL: https://www.youtube.com/@InnerSourceCommons
25-
weight: 6
36+
parent: projects
37+
weight: 2
38+
- name: Training
39+
URL: learn
40+
weight: 3
41+
identifier: training
42+
- name: Books
43+
URL: learn/books
44+
parent: training
45+
weight: 1
46+
- name: Learning Path
47+
URL: learn/learning-path
48+
parent: training
49+
weight: 2
50+
- name: Community
51+
URL: community
52+
weight: 4
53+
identifier: community
2654
- name: Events
2755
URL: events/community-calls
28-
weight: 2
29-
identifier: events
56+
parent: community
57+
weight: 1
3058
- name: Summit 2024
3159
URL: events/isc-2024
32-
parent: events
33-
weight: 4
60+
parent: community
61+
weight: 2
3462
- name: Local Gatherings
3563
URL: https://gatherings.innersourcecommons.org/
36-
parent: events
37-
weight: 5
64+
parent: community
65+
weight: 3
3866
- name: Community Calls
3967
URL: events/community-calls
40-
parent: events
41-
weight: 6
42-
- name: Past Summits
43-
URL: events/past-summits
44-
parent: events
45-
weight: 7
68+
parent: community
69+
weight: 4
4670
- name: Calendar
4771
URL: calendar
48-
weight: 3
49-
- name: Community
50-
identifier: community
51-
URL: community
52-
weight: 4
53-
- name: Stories
54-
URL: stories
72+
parent: community
5573
weight: 5
5674
- name: Services Directory
5775
URL: community/services
5876
parent: community
59-
weight: 2
60-
- name: About
61-
identifier: about
62-
URL: about
6377
weight: 6
78+
- name: Blog & News
79+
URL: about/announcements
80+
weight: 5
81+
identifier: news
6482
- name: Announcements
6583
URL: about/announcements
66-
parent: about
84+
parent: news
6785
weight: 1
68-
- name: Board & Governance
69-
URL: about/board
70-
parent: about
86+
- name: Stories
87+
URL: stories
88+
parent: news
7189
weight: 2
72-
- name: Members
73-
URL: about/members
74-
parent: about
75-
weight: 3
76-
- name: Sponsors
77-
URL: about/sponsors
78-
parent: about
79-
weight: 4
80-
- name: Code of Conduct
81-
URL: about/codeofconduct
82-
parent: about
83-
weight: 5
84-
- name: Contact Us
85-
URL: about/contact
86-
parent: about
87-
weight: 6
88-
# - name: Vacancies
89-
# URL: about/vacancies
90-
# parent: about
91-
# weight: 7
9290
footer_left:
9391
- name: Learn
9492
URL: learn

config/_default/params.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins:
55
- link: plugins/slick/slick.css
66
- link: plugins/youmax/youmax.css
77
- link: plugins/bootstrap-select/css/bootstrap-select.min.css
8+
- link: css/custom-menu.css
89
js:
910
- link: plugins/jQuery/jquery.min.js
1011
- link: plugins/bootstrap/bootstrap.min.js

layouts/partials/header.html

Lines changed: 129 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,90 @@
11
{{ "<!-- navigation -->" | safeHTML }}
22
<header class="navigation">
3-
<div class="container">
4-
<!-- navbar -->
5-
<nav class="navbar navbar-expand-lg navbar-light bg-transparent">
6-
<a class="navbar-brand"
7-
href='{{ if eq .Site.Language.Lang "en" }}{{ site.BaseURL }}{{ else }}{{ site.BaseURL }}{{ .Site.Language.Lang }}{{end}}'>
8-
<img width="{{ site.Params.logo_width}}" class="img-fluid" src="{{ site.Params.logo | absURL }}"
9-
alt="{{ site.Title }}">
3+
<div class="container wrap">
4+
<div class="logo">
5+
<a href='{{ if eq .Site.Language.Lang "en" }}{{ site.BaseURL }}{{ else }}{{ site.BaseURL }}{{ .Site.Language.Lang }}{{end}}' title="{{ site.Title }}">
6+
<img loading="eager" decoding="async" fetchpriority="high" width="{{ site.Params.logo_width}}" class="img-fluid" src="{{ site.Params.logo | absURL }}" alt="{{ site.Title }}">
107
</a>
11-
<button class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navigation">
12-
<i class="ti-menu"></i>
13-
</button>
14-
15-
<div class="collapse navbar-collapse text-center" id="navigation">
16-
<ul class="navbar-nav mx-auto">
17-
{{ range site.Menus.main }}
18-
{{ if .HasChildren }}
19-
<li class="nav-item dropdown">
20-
<a class="nav-link nav-with-toggle" href="{{ .URL | absURL }}" {{ with .Pre }} target="{{ . }}" {{ end }}>{{.Name }}</a>
21-
<a class="dropdown-toggle" href="#" role="button" data-toggle="dropdown" data-reference="dropdown-toggle"
22-
data-display="static"></a>
23-
<div class="dropdown-menu">
24-
{{ range .Children }}
25-
<a class="dropdown-item" href="{{ .URL | absURL }}" {{ with .Pre }} target="{{ . }}" {{ end }}>{{ .Name }}</a>
26-
{{ end }}
8+
</div>
9+
10+
<nav class="main-menu">
11+
<ul class="main-menu__wrapper">
12+
{{ range site.Menus.main }}
13+
{{ if .HasChildren }}
14+
<li class="menu-item-has-children">
15+
<a href="#"><span>{{ .Name }}</span></a>
16+
<div class="sub-menu">
17+
<div class="col-container">
18+
<div class="col1">
19+
<ul class="menu">
20+
<li class="menu-title">Main</li>
21+
{{ range first 5 .Children }}
22+
<li class="menu-item">
23+
<a href="{{ .URL | absURL }}" {{ with .Pre }} target="{{ . }}" {{ end }}>
24+
{{ .Name }}
25+
{{ if .Post }}<span class="menu-description">{{ .Post }}</span>{{ end }}
26+
</a>
27+
</li>
28+
{{ end }}
29+
</ul>
30+
</div>
31+
<div class="col2">
32+
<ul class="menu">
33+
<li class="menu-title">Additional Info</li>
34+
{{ range after 5 .Children }}
35+
<li class="menu-item">
36+
<a href="{{ .URL | absURL }}" {{ with .Pre }} target="{{ . }}" {{ end }}>
37+
{{ .Name }}
38+
{{ if .Post }}<span class="menu-description">{{ .Post }}</span>{{ end }}
39+
</a>
40+
</li>
41+
{{ end }}
42+
</ul>
43+
</div>
44+
<div class="col3">
45+
<ul class="menu">
46+
<li class="menu-title">Featured Articles</li>
47+
</ul>
48+
<div class="featured-articles">
49+
{{ if eq .Name "About" }}
50+
<div class="article-card">
51+
<img src="/images/featured/about.jpg" alt="About Us">
52+
<h4>Who We Are</h4>
53+
<p>Learn more about InnerSource Commons</p>
54+
</div>
55+
{{ else if eq .Name "Projects" }}
56+
<div class="article-card">
57+
<img src="/images/featured/projects.jpg" alt="Our Projects">
58+
<h4>Latest Projects</h4>
59+
<p>Discover our latest InnerSource initiatives</p>
60+
</div>
61+
{{ end }}
62+
</div>
63+
</div>
2764
</div>
28-
</li>
29-
{{ else }}
30-
<li class="nav-item">
31-
<a class="nav-link" href="{{ .URL | absURL }}" {{ with .Pre }} target="{{ . }}" {{ end }}>{{ .Name }}</a>
32-
</li>
33-
{{ end }}
34-
{{ end }}
35-
</ul>
36-
<a href="{{ "slack" | absURL }}" class="btn btn-sm slack-invite-btn btn-primary ml-2" target="_blank"><i
37-
class="ti-comments pr-2"></i>{{ T "join_slack" }}</a>
65+
</div>
66+
</li>
67+
{{ else }}
68+
<li class="menu-item">
69+
<a href="{{ .URL | absURL }}" {{ with .Pre }} target="{{ . }}" {{ end }}><span>{{ .Name }}</span></a>
70+
</li>
71+
{{ end }}
72+
{{ end }}
73+
</ul>
74+
75+
<div class="header-cta">
76+
<a href="{{ "slack" | absURL }}" class="btn btn-primary" target="_blank">
77+
<i class="ti-comments pr-2"></i>{{ T "join_slack" }}
78+
</a>
3879
{{ if in .CurrentSection.Permalink "/learn/learning-path"}}
39-
<select id="langpicker" class="selectpicker" data-style="btn-light btn-sm ml-3" data-width="fit">
80+
<select id="langpicker" class="selectpicker" data-style="btn-light" data-width="fit">
4081
<option>{{ .Site.Language.LanguageName }}</option>
4182
{{ range .Translations }}
4283
<option value="{{ .Permalink }}">{{ .Language.LanguageName }}</option>
4384
{{ end }}
4485
</select>
4586
{{ else }}
46-
<select id="langpicker" class="selectpicker" data-style="btn-light btn-sm ml-3" data-width="fit">
87+
<select id="langpicker" class="selectpicker" data-style="btn-light" data-width="fit">
4788
<option>{{ .Site.Language.LanguageName }}</option>
4889
{{ range where .Translations ".Language.Lang" "in" "en ja fr pt-br"}}
4990
<option value="{{ .Permalink }}">{{ .Language.LanguageName }}</option>
@@ -52,8 +93,61 @@
5293
{{ end }}
5394
</div>
5495
</nav>
96+
97+
<button class="hamburger" type="button" aria-label="Toggle Menu">
98+
<span class="hamburger-box">
99+
<span class="hamburger-inner"></span>
100+
</span>
101+
</button>
55102
</div>
56103
</header>
104+
105+
<script>
106+
document.addEventListener('DOMContentLoaded', function() {
107+
const hamburger = document.querySelector('.hamburger');
108+
const menu = document.querySelector('.main-menu__wrapper');
109+
const subMenuParents = document.querySelectorAll('.menu-item-has-children > a');
110+
const isMobile = window.innerWidth <= 992;
111+
112+
// ハンバーガーメニューの開閉
113+
hamburger.addEventListener('click', function() {
114+
this.classList.toggle('is-active');
115+
menu.classList.toggle('is-active');
116+
});
117+
118+
// モバイル時のサブメニュー制御
119+
if (isMobile) {
120+
subMenuParents.forEach(item => {
121+
item.addEventListener('click', function(e) {
122+
e.preventDefault();
123+
const parent = this.parentElement;
124+
const subMenu = this.nextElementSibling;
125+
126+
// 他のメニューを閉じる
127+
subMenuParents.forEach(otherItem => {
128+
if (otherItem !== this) {
129+
otherItem.parentElement.classList.remove('is-active');
130+
otherItem.nextElementSibling.classList.remove('is-active');
131+
}
132+
});
133+
134+
// 現在のメニューをトグル
135+
parent.classList.toggle('is-active');
136+
subMenu.classList.toggle('is-active');
137+
});
138+
});
139+
}
140+
141+
// ウィンドウリサイズ時の処理
142+
window.addEventListener('resize', function() {
143+
const isNowMobile = window.innerWidth <= 992;
144+
if (isNowMobile !== isMobile) {
145+
location.reload();
146+
}
147+
});
148+
});
149+
</script>
150+
57151
{{ "<!-- /navigation -->" | safeHTML }}
58152

59153
<!-- <section class="notice bg-primary text-light">

0 commit comments

Comments
 (0)