Skip to content

Commit 2f8655f

Browse files
committed
Allow maps to appear at any directory level
Before this change, the root `content/_index.md` file would always render using `layouts/index.html` (which hard-coded the ability to render maps), and it was not possible to render maps anywhere else. Instead, make map rendering details a partial which can be invoked from anywhere, and wire up a `map` layout that can be opted into with `layout = "map"` in frontmatter. `layouts/index.html` also calls this same partial, so they behave the same - we're just hard-coding that the root layout should always be a map layout, just like any other map layout can be. Also, un-set the root Piscine layout - it's ignored, hugo always uses `layouts/index.html` for the root layout, so stop pretending it uses a module layout (which, incidentally, it doesn't).
1 parent ce20333 commit 2f8655f

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ define "main" }}
2+
{{ partial "index.html" . }}
3+
{{ end }}

common-theme/layouts/index.html

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
11
{{ define "main" }}
2-
<article>
3-
{{- .Scratch.Set "headerClass"
4-
"c-page-header--splash"
5-
}}
6-
{{- partial "page-header.html" . }}
7-
{{ with .Content }}
8-
<section class="c-copy">
9-
{{ . }}
10-
</section>
11-
{{ end }}
12-
{{ if .Params.menus_to_map }}
13-
{{ partial "map-menu.html" .Params.menus_to_map }}
14-
{{ else if .Params.menus_to_map_for_courses }}
15-
{{ partial "map-menu-for-courses.html" .Params.menus_to_map_for_courses }}
16-
{{ else if .Params.map }}
17-
{{ partial "map.html" . }}
18-
{{ else if .Params.taxonomy_to_map }}
19-
{{ partial "map-taxonomy.html" .Params.taxonomy_to_map }}
20-
{{ else }}
21-
<ol class="c-timeline c-timeline--card">
22-
{{- range site.Menus.syllabus }}
23-
<li class="c-timeline__entry">{{ partial "card.html" . }}</li>
24-
{{- end }}
25-
</ol>
26-
{{ end }}
27-
</article>
2+
{{ partial "index.html" . }}
283
{{ end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<article>
2+
{{- .Scratch.Set "headerClass"
3+
"c-page-header--splash"
4+
}}
5+
{{- partial "page-header.html" . }}
6+
{{ with .Content }}
7+
<section class="c-copy">
8+
{{ . }}
9+
</section>
10+
{{ end }}
11+
{{ if .Params.menus_to_map }}
12+
{{ partial "map-menu.html" .Params.menus_to_map }}
13+
{{ else if .Params.map }}
14+
{{ partial "map.html" . }}
15+
{{ else if .Params.menus_to_map_for_courses }}
16+
{{ partial "map-menu-for-courses.html" .Params.menus_to_map_for_courses }}
17+
{{ else if .Params.taxonomy_to_map }}
18+
{{ partial "map-taxonomy.html" .Params.taxonomy_to_map }}
19+
{{ else }}
20+
<ol class="c-timeline c-timeline--card">
21+
{{- range site.Menus.syllabus }}
22+
<li class="c-timeline__entry">{{ partial "card.html" . }}</li>
23+
{{- end }}
24+
</ol>
25+
{{ end }}
26+
</article>

org-cyf-piscine/content/_index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
+++
22
title = 'Piscine'
33
description = 'In teams and on your own, build working software with tests. Explain your work to others.'
4-
layout = 'module'
54
menu = ['syllabus', 'next steps']
65
menus_to_map=['entry', 'sprints', 'assessment']
76
+++

0 commit comments

Comments
 (0)