Skip to content

Commit f028e0e

Browse files
authored
Merge pull request #67 from layer5io/exam
update archetype and id generation
2 parents 8044731 + 846218a commit f028e0e

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

archetypes/quiz.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
title: '{{ replace .File.ContentBaseName `-` ` ` | title }}'
3-
id: "replace-with-unique-id"
43
pass_percentage: 70 # Minimum percentage required to pass the quiz
5-
duration_minutes: 15 # Duration of the quiz in minutes
4+
time_limit: 15 # Duration of the quiz in minutes
65
difficulty: "beginner" # Difficulty level of the quiz
76
category: "Programming Languages" # Category of the quiz
87
tags: ["golang", "basics", "syntax", "fundamentals"] # Tags for the quiz, useful for search and categorization

layouts/list.json.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
{
3232

33-
"id": {{ or $p.Params.Id (md5 $p.Permalink) | jsonify }},
33+
"id": {{ partial "id.html" $p }},
3434
"level": {{ or $level "beginner" | jsonify }},
3535
"slug": {{ or $p.Slug $p.File.ContentBaseName | jsonify }},
3636
"org_id": {{ $uuid | jsonify }},
@@ -60,7 +60,7 @@
6060
{
6161
"title": {{ $c.Title | jsonify }},
6262
"slug": {{ or $c.Slug $c.File.ContentBaseName | jsonify }},
63-
"id": {{ or $c.Params.Id $c.Permalink | jsonify }},
63+
"id": {{ partial "id.html" $c }},
6464
"level": {{ $c.Params.level | jsonify }},
6565
"description": {{ $c.Description | jsonify }},
6666
"weight": {{ $c.Params.Order | jsonify}},

layouts/partials/id.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{- $id := .Params.id -}}
2+
{{- if $id -}}
3+
{{ $id | jsonify }}
4+
{{- else -}}
5+
{{ .RelPermalink | md5 | jsonify }}
6+
{{- end -}}

layouts/quiz/single.json.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ $p := .Params }}
22
{
3-
"id": {{ $p.id | jsonify }},
3+
"id": {{ partial "id.html" . }},
44
"title": {{ $p.title | jsonify }},
55
"description": {{ .Content | plainify | jsonify }},
66
"slug": {{ .Slug | jsonify }},
@@ -24,7 +24,7 @@
2424
{{ $total }},
2525
"parent": {{- with .Parent -}}
2626
{
27-
"id": {{ .Params.id | default "unknown" | jsonify }},
27+
"id": {{ partial "id.html" . }},
2828
"title": {{ .Title | jsonify }},
2929
"relPermalink": {{ .RelPermalink | jsonify }},
3030
"type": {{ .Type | jsonify }}

0 commit comments

Comments
 (0)