Skip to content

Commit 9347e78

Browse files
authored
Merge pull request #61 from layer5io/enhance-schema
Update list view to latest schema and add module archetype
2 parents bc91704 + f1025f4 commit 9347e78

File tree

3 files changed

+48
-31
lines changed

3 files changed

+48
-31
lines changed

archetypes/course.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ type: "course"
33
title: '{{ replace .File.ContentBaseName `-` ` ` | title }}'
44
description: "Enter a detailed introduction to the course here..."
55
weight: 1
6-
# Banner image for the course. Must be a full path including the UUID.
6+
# Banner image for the course. Must be a path relative to your static folder (eg images/... ) .without org uuid.
77
banner: ""
8-
---
8+
---

archetypes/module.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: "module"
3+
title: '{{ replace .File.ContentBaseName `-` ` ` | title }}'
4+
description: "Enter a detailed introduction to the module here..."
5+
weight: 1
6+
banner: ""
7+
---

layouts/list.json.json

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,47 @@
1818
{{- end -}}
1919

2020
{
21-
"title": {{ $p.Title | jsonify }},
22-
"description": {{ $p.Description | jsonify }},
23-
"banner": {{ $banner_url | jsonify }},
24-
"slug": {{ or $p.Slug $p.File.ContentBaseName | jsonify }},
25-
"permalink": {{ $p.Permalink | jsonify }},
26-
"level": {{ $p.Params.level | jsonify }},
21+
2722
"id": {{ or $p.Params.Id (md5 $p.Permalink) | jsonify }},
28-
"orgId": {{ $uuid | jsonify }},
23+
"level": {{ or $p.Params.level "beginner" | jsonify }},
24+
"slug": {{ or $p.Slug $p.File.ContentBaseName | jsonify }},
25+
"org_id": {{ $uuid | jsonify }},
2926
"type": {{ $p.Params.Type | jsonify }} ,
30-
"courses": [
31-
{{- range $j, $c := $children }}
32-
{{- if $j }},{{ end }}
33-
34-
{{- /* Prepend the orgId to the nested Course's banner path. */ -}}
35-
{{- $course_banner_url := "" -}}
36-
{{- if $c.Params.Banner -}}
37-
{{- $course_banner_url = printf "%s/%s" $uuid $c.Params.Banner | absURL -}}
38-
{{- end -}}
39-
40-
{
41-
"title": {{ $c.Title | jsonify }},
42-
"slug": {{ or $c.Slug $c.File.ContentBaseName | jsonify }},
43-
"id": {{ or $c.Params.Id $c.Permalink | jsonify }},
44-
"level": {{ $c.Params.level | jsonify }},
45-
"description": {{ $c.Description | jsonify }},
46-
"weight": {{ $c.Params.Order | jsonify}},
47-
"banner": {{ $course_banner_url | jsonify }},
48-
"permalink": {{ $c.Permalink | jsonify }}
49-
}
50-
{{- end }}
51-
]
27+
"visibility": {{ or $p.Params.Visibility "public" | jsonify }},
28+
"status": {{ or $p.Params.Status "ready" | jsonify }},
29+
30+
{{- /* Metadata for the Learning Path */ -}}
31+
32+
"metadata": {
33+
"title": {{ $p.Title | jsonify }},
34+
"description": {{ $p.Description | jsonify }},
35+
"banner": {{ $banner_url | jsonify }},
36+
"permalink": {{ $p.Permalink | jsonify }},
37+
"categories": {{ $p.Params.Categories | jsonify }},
38+
"tags": {{ $p.Params.Tags | jsonify }},
39+
"courses": [
40+
{{- range $j, $c := $children }}
41+
{{- if $j }},{{ end }}
42+
43+
{{- /* Prepend the orgId to the nested Course's banner path. */ -}}
44+
{{- $course_banner_url := "" -}}
45+
{{- if $c.Params.Banner -}}
46+
{{- $course_banner_url = printf "%s/%s" $uuid $c.Params.Banner | absURL -}}
47+
{{- end -}}
48+
49+
{
50+
"title": {{ $c.Title | jsonify }},
51+
"slug": {{ or $c.Slug $c.File.ContentBaseName | jsonify }},
52+
"id": {{ or $c.Params.Id $c.Permalink | jsonify }},
53+
"level": {{ $c.Params.level | jsonify }},
54+
"description": {{ $c.Description | jsonify }},
55+
"weight": {{ $c.Params.Order | jsonify}},
56+
"banner": {{ $course_banner_url | jsonify }},
57+
"permalink": {{ $c.Permalink | jsonify }}
58+
}
59+
{{- end }}
60+
]
61+
}
5262
}
5363
{{- end }}
5464
]

0 commit comments

Comments
 (0)