Skip to content

Commit 91ecd18

Browse files
committed
add "needs-transcript" functionality
sources suggested for transcription are now accessible as part of `/status.json`
1 parent b0d2fd6 commit 91ecd18

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

config.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DefaultContentLanguage = "en"
1010
category = 'categories'
1111
tag = 'tags'
1212
speaker = 'speakers'
13+
needs = 'needs'
1314

1415
[module]
1516
[[module.mounts]]

themes/ace-documentation/layouts/_default/list.status.json

+27-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
{{ $speakerData := slice }}
2626
{{ $tagData := slice }}
2727
{{ $categoryData := slice }}
28+
{{ $needsData := dict }}
2829

2930
{{ range .Site.Taxonomies.speakers }}
3031
{{ $speakerData = $speakerData | append .Page.LinkTitle }}
@@ -47,17 +48,41 @@
4748
{{ $categoryData = $categoryData | append $category }}
4849
{{ end }}
4950

51+
{{ range $need, $pages := .Site.Taxonomies.needs }}
52+
{{ $transcriptsForNeed := slice }}
53+
{{ range $pages }}
54+
{{ $formattedDate := "" }}
55+
{{ if isset .Params "date" }}
56+
{{ $formattedDate = dateFormat "2006-01-02" .Params.date }}
57+
{{ end }}
58+
{{ $transcriptData := dict
59+
"url" .Permalink
60+
"title" .Title
61+
"tags" .Params.tags
62+
"speakers" .Params.speakers
63+
"source_file" .Params.media
64+
"categories" .Params.categories
65+
"date" $formattedDate
66+
"loc" (path.Dir .File.Path)
67+
}}
68+
{{ $transcriptsForNeed = $transcriptsForNeed | append $transcriptData }}
69+
{{ end }}
70+
{{ $needsData = merge $needsData (dict $need $transcriptsForNeed) }}
71+
{{ end }}
72+
5073
{{ $media := slice }}
5174

5275
{{ range .Site.RegularPages }}
5376
{{ $mediaValue := .Params.media }}
54-
{{ if $mediaValue }}
55-
{{ $media = $media | append $mediaValue }}
77+
{{ $needsTranscription := in .Params.needs "transcription" }}
78+
{{ if and $mediaValue (not $needsTranscription) }}
79+
{{ $media = $media | append $mediaValue }}
5680
{{ end }}
5781
{{ end }}
5882

5983
{{ $jsonData := dict "speakers" $speakerData "tags" $tagData "categories" $categoryData "media" $media }}
6084
{{- $.Scratch.SetInMap "status" "existing" $jsonData -}}
6185
{{- $.Scratch.SetInMap "status" "missing" ($.Scratch.Get "missing") -}}
6286
{{- $.Scratch.SetInMap "status" "transcripts" ($.Scratch.Get "transcripts") -}}
87+
{{- $.Scratch.SetInMap "status" "needs" $needsData -}}
6388
{{- $.Scratch.Get "status" | jsonify -}}

themes/ace-documentation/layouts/_default/single.html

+16-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ <h1>{{ .Title }}</h1>
1616
<p><i>{{ i18n "date" | title }}: {{ .Params.date.Format "January 2, 2006" }}</i></p>
1717
{{ end }}
1818

19-
<p><i>{{ i18n "transcript_by" | title }}: {{ .Params.transcript_by }}</i></p>
19+
{{ if .Params.transcript_by }}
20+
<p><i>{{ i18n "transcript_by" | title }}: {{ .Params.transcript_by }}</i></p>
21+
{{ end }}
2022

2123
{{ if .Params.translation_by }}
2224
<p><i>{{ i18n "translation_by" | title }}: {{ .Params.translation_by }}</i></p>
@@ -59,6 +61,19 @@ <h1>{{ .Title }}</h1>
5961
</div>
6062
{{ end }}
6163

64+
{{ if in .Params.needs "transcript" }}
65+
<div class="alert alert-warning">
66+
<div class="ai-generated">
67+
<i class='fas fa-robot'></i>
68+
<span>This source has been suggested for transcription</span>
69+
</div>
70+
<span>The AI-generated transcript will be available for review shortly.</span>
71+
<a href="https://review.btctranscripts.com" target="_blank" data-umami-event="click-transcript-banner">
72+
Learn More >
73+
</a>
74+
</div>
75+
{{ end }}
76+
6277
{{ .Content }}
6378

6479
{{ if .IsTranslated }}

0 commit comments

Comments
 (0)