-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
# filter facets generator | ||
# this creates a csv of unique values that are stored in your transcripts 'tags' column and their counts | ||
# | ||
# Requires CB's array_count_uniq.rb plugin! | ||
--- | ||
{% assign transcripts = site.data.transcripts %}{% for transcript in transcripts %} | ||
{% assign items = transcript[1] %} | ||
{%- assign min-count = 1 -%} | ||
{%- assign raw-subjects = items | map: "tags" | compact | join: ";" | split: ";" -%} | ||
{%- capture subjects -%}{% for s in raw-subjects %}{% if s != "" %}{{- s | strip | downcase -}};{% endif %}{%- endfor -%}{%-endcapture -%} | ||
{%- assign subjects = subjects | split: ";" -%} | ||
{%- assign allSubjects = allSubjects | concat: subjects -%}{% endfor %} | ||
{ | ||
"facets": [ | ||
{%- assign uniqueArray = allSubjects | array_count_uniq -%} | ||
{ | ||
"field": "tags", | ||
"terms": { {% for unique in uniqueArray %} | ||
{{ unique[0] | jsonify }}: {{ unique[1] | jsonify }}{% unless forloop.last %},{% endunless %}{% endfor %} | ||
} | ||
}{% unless forloop.last %},{% endunless %} | ||
] | ||
} |
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,15 @@ | ||
--- | ||
# create a filters.csv for the oral history visualization or check your filters against an autogenerated one | ||
--- | ||
{% assign transcripts = site.data.transcripts %}{% for transcript in transcripts %} | ||
{% assign items = transcript[1] %} | ||
{%- assign min-count = 1 -%} | ||
{%- assign raw-subjects = items | map: "tags" | compact | join: ";" | split: ";" -%} | ||
{%- capture subjects -%}{% for s in raw-subjects %}{% if s != "" %}{{- s | strip | downcase -}};{% endif %}{%- endfor -%}{%-endcapture -%} | ||
{%- assign subjects = subjects | split: ";" -%} | ||
{%- assign uniqueSubjects = subjects | uniq | sort -%} | ||
{%- assign allUniqueSubjects = allUniqueSubjects | concat: uniqueSubjects -%}{% endfor %} | ||
{%- assign tags = allUniqueSubjects | uniq | sort -%} | ||
tag,description{% for tag in tags %} | ||
{%- if tag != "" -%}{{ tag }},"On {{ tag}}"{% endif %} | ||
{% endfor %} |