Initial commit
This commit is contained in:
18
assets/data/subjects.json
Normal file
18
assets/data/subjects.json
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# find and count unique subjects
|
||||
#
|
||||
# Requires CB's array_count_uniq.rb plugin!
|
||||
---
|
||||
{%- if site.data.theme.subjects-fields -%}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign subjects-fields = site.data.theme.subjects-fields | split: ";" -%}
|
||||
{%- assign subjects = "" -%}
|
||||
{%- for c in subjects-fields -%}
|
||||
{% assign new = items | map: c | join: ";" %}
|
||||
{% assign subjects = subjects | append: ";" | append: new %}
|
||||
{%- endfor -%}
|
||||
{%- assign uniqSubjects = subjects | downcase | split: ";" | array_count_uniq -%}
|
||||
{ "subjects": [
|
||||
{% for s in uniqSubjects %}{ "subject" : {{ s[0] | jsonify }}, "count" : {{ s[1] | jsonify }}, "link" : {{ s[0] | url_param_escape | prepend: '/browse.html#' | absolute_url | jsonify }} }{% unless forloop.last %},
|
||||
{% endunless %}{% endfor %}
|
||||
]}{%- endif -%}
|
||||
Reference in New Issue
Block a user