-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create more json outputs with useful data
We already create `/index.json` which is used for searching. This creates two more: - `/status.json` provides: - information about all the existing taxonomies & media - information about which transcripts are missing which field. - provides the number of transcripts for each language. - `/directories.json` provides - information about all the existing directories (supports nesting up to 2 levels) and their total number of transcripts
- Loading branch information
Showing
5 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
themes/ace-documentation/layouts/_default/list.directories.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ range .Site.Sections }} | ||
{{ $sectionKey := .File.ContentBaseName }} | ||
{{ if ne $sectionKey "" }} | ||
{{ $section := newScratch }} | ||
{{ $.Scratch.SetInMap "result" $sectionKey (len .Pages) }} | ||
|
||
{{ range .Pages }} | ||
{{ if eq .BundleType "branch" }} | ||
{{ $subsectionKey := .File.ContentBaseName }} | ||
{{ $subsection := newScratch }} | ||
{{ $section.Set $subsectionKey (len .Pages) }} | ||
|
||
{{ range .Pages }} | ||
{{ if eq .BundleType "branch" }} | ||
{{ $subsection.Set .File.ContentBaseName (len .Pages) }} | ||
{{ end }} | ||
{{ end }} | ||
{{ if gt ($subsection.Values | len) 0 }} | ||
{{ $section.Set $subsectionKey $subsection.Values }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
{{ if gt ($section.Values | len) 0 }} | ||
{{ $.Scratch.SetInMap "result" $sectionKey $section.Values }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ $.Scratch.Get "result" | jsonify }} |
File renamed without changes.
56 changes: 56 additions & 0 deletions
56
themes/ace-documentation/layouts/_default/list.status.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{{- $.Scratch.Set "missing" (dict "speakers" (slice) "date" (slice) "transcript_by" (slice) "categories" (slice) "tags" (slice) "media" (slice)) -}} | ||
{{- $.Scratch.Set "es" 0 -}} | ||
{{- $.Scratch.Set "pt" 0 -}} | ||
{{- $.Scratch.Set "zh" 0 -}} | ||
|
||
{{- range .Site.RegularPages -}} | ||
{{- $params := .Params -}} | ||
{{- $path := .Permalink -}} | ||
{{- range $key, $value := $.Scratch.Get "missing" -}} | ||
{{- if not (isset $params $key) -}} | ||
|
||
{{- $.Scratch.SetInMap "missing" $key ($value | append $path) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- with .Translations -}} | ||
{{- range . -}} | ||
{{- $lang := .Lang -}} | ||
{{- $.Scratch.Add $lang 1 -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- end -}} | ||
|
||
{{- $.Scratch.Set "transcripts" (dict "en" (len .Site.RegularPages) "es" ($.Scratch.Get "es") "pt" ($.Scratch.Get "pt") "zh" ($.Scratch.Get "zh")) -}} | ||
|
||
{{ $speakerData := slice }} | ||
{{ $tagData := slice }} | ||
{{ $categoryData := slice }} | ||
|
||
{{ range $speaker, $not_used := .Site.Taxonomies.speakers }} | ||
{{ $speakerData = $speakerData | append $speaker }} | ||
{{ end }} | ||
|
||
{{ range $tag, $not_used := .Site.Taxonomies.tags }} | ||
{{ $tagData = $tagData | append $tag }} | ||
{{ end }} | ||
|
||
{{ range $category, $not_used := .Site.Taxonomies.categories }} | ||
{{ $categoryData = $tagData | append $category }} | ||
{{ end }} | ||
|
||
{{ $media := slice }} | ||
|
||
{{ range .Site.RegularPages }} | ||
{{ $mediaValue := .Params.media }} | ||
{{ if $mediaValue }} | ||
{{ $media = $media | append $mediaValue }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ $jsonData := dict "speakers" $speakerData "tags" $tagData "categories" $categoryData "media" $media }} | ||
{{- $.Scratch.SetInMap "status" "existing" $jsonData -}} | ||
{{- $.Scratch.SetInMap "status" "missing" ($.Scratch.Get "missing") -}} | ||
{{- $.Scratch.SetInMap "status" "transcripts" ($.Scratch.Get "transcripts") -}} | ||
{{- $.Scratch.Get "status" | jsonify -}} |