Skip to content

Commit 177f73c

Browse files
committed
Support additional track info in playlist
This allows the user-defined mixtape.tmpl to define track notes for each individual track. By default, it only shows notes for the currently-playing track.
1 parent 9a8150b commit 177f73c

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

mixtape.tmpl

+18
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,31 @@
1414
#playlist li {
1515
margin: 0.5em 0;
1616
}
17+
li p {
18+
display: none;
19+
font-style: italic;
20+
}
1721
li.active a {
1822
font-weight: bold;
1923
}
24+
li.active p {
25+
display: block;
26+
}
2027
</style>
2128
</head>
2229
<body>
2330
{{template "full-player" .Tracks}}
2431
</body>
2532
</html>
33+
{{end}}
34+
35+
{{define "track-info"}}
36+
{{if eq .Num 1}}
37+
<p>[Here I might introduce this mix.]</p>
38+
<p>[Some notes about track 1.]</p>
39+
{{else if eq .Num 2}}
40+
<p>[Some notes about track 2.]</p>
41+
{{else if eq .Num 5}}
42+
<p>[Some notes about track 5.]</p>
43+
{{end}}
2644
{{end}}

templates.go

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/parts.tmpl

+3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
{{range $i, $el := .}}
1111
<li{{if eq $i 0}} class="active"{{end}}>
1212
<a href="{{$el.Filename}}">{{$el.Artist}} - {{$el.Title}}</a>
13+
{{template "track-info" $el}}
1314
</li>
1415
{{end}}
1516
</ol>
1617
{{end}}
1718

19+
{{define "track-info"}}{{end}}
20+
1821
{{define "full-player"}}
1922
{{template "player" .}}
2023
{{template "playlist" .}}

0 commit comments

Comments
 (0)