Initial commit
This commit is contained in:
29
assets/data/collection-info.json
Normal file
29
assets/data/collection-info.json
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
# create collection description and stats
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign raw-dates = items | map: 'date' | compact | uniq -%}
|
||||
{%- capture clean-years -%}{% for date in raw-dates %}{% if date contains "-" %}{{ date | strip | split: "-" | first }}{% elsif date contains "/" %}{{ date | strip | split: "/" | last }}{% else %}{{ date | strip }}{% endif %}{% unless forloop.last %};{% endunless %}{%- endfor -%}{%- endcapture -%}
|
||||
{%- assign date-range = clean-years | remove: " " | split: ";" | uniq | sort -%}
|
||||
{%- assign formats = items | map: 'format' -%}
|
||||
{%- assign formats_uniq = formats | uniq -%}
|
||||
{
|
||||
"title": "{{ site.title }}",
|
||||
"url": "{{ '/' | absolute_url }}",
|
||||
"image": "{{ site.data.featured_item.src | relative_url }}",
|
||||
"description": "{{ site.description }}",
|
||||
"publisher": {
|
||||
"name": "{{ site.organization-name }}",
|
||||
"url": "{{ site.organization-link }}",
|
||||
"logo": "{{ site.organization-logo-banner }}"
|
||||
},
|
||||
"date_start": "{{ date-range | first }}",
|
||||
"date_end": "{{ date-range | last }}",
|
||||
"objects": {
|
||||
{% for f in formats_uniq %}{% assign count = formats | where_exp: 'i', 'i contains f' | size %}{{ f | jsonify }}: "{{ count }}"{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
},
|
||||
"data": "{{ '/assets/data/datapackage.json' | absolute_url }}",
|
||||
"last_build_date": "{{ site.time | date: '%Y-%m-%d' }}"
|
||||
}
|
||||
|
||||
146
assets/data/datapackage.json
Normal file
146
assets/data/datapackage.json
Normal file
@@ -0,0 +1,146 @@
|
||||
---
|
||||
# generate a datapackage.json file
|
||||
# based on Frictionless Data "Data Package" Spec
|
||||
# https://specs.frictionlessdata.io/data-package/
|
||||
---
|
||||
{%- assign stubs = site.data.config-nav | map: 'stub' | join: ';' -%}
|
||||
{
|
||||
"profile": "data-package",
|
||||
"name": "{{ site.title | slugify }}-data",
|
||||
"title": "{{ site.title | escape }} Data",
|
||||
"description": "Metadata and data derived from {{ site.title | escape }}. {{ site.description | escape }}",
|
||||
{% if site.keywords %}"keywords": {% assign keywords = site.keywords | split: ';' %} {{ keywords | jsonify }},{% endif %}
|
||||
"homepage": "{{ '/' | absolute_url }}",
|
||||
"contributors": [
|
||||
{
|
||||
"title": "{{ site.organization-name | escape }}",
|
||||
"path": "{{ site.organization-link }}",
|
||||
"role": "author"
|
||||
}
|
||||
],
|
||||
"image": "{{ site.data.featured_item.src | relative_url }}",
|
||||
"licenses": [
|
||||
{
|
||||
"name": "CC0-1.0",
|
||||
"title": "CC0 1.0",
|
||||
"path": "https://creativecommons.org/publicdomain/zero/1.0/"
|
||||
}
|
||||
],
|
||||
"resources": [
|
||||
{% if site.data.theme.metadata-facets-fields %}
|
||||
{
|
||||
"name": "facets-json",
|
||||
"path": "facets.json",
|
||||
"title": "{{ site.title | escape }} Metadata Facets",
|
||||
"description":"Unique values and counts of metadata facet fields.",
|
||||
"format":"json",
|
||||
"profile": "data-resource"
|
||||
},{% endif %}
|
||||
{% if stubs contains "subject" %}
|
||||
{
|
||||
"name": "subject-csv",
|
||||
"path": "subjects.csv",
|
||||
"title": "{{ site.title | escape }} metadata subject counts in csv",
|
||||
"description": "Unique values and counts of metadata subject fields.",
|
||||
"format":"csv",
|
||||
"profile":"tabular-data-resource",
|
||||
"schema": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "subject",
|
||||
"type": "string",
|
||||
"format": "default"
|
||||
},
|
||||
{
|
||||
"name": "count",
|
||||
"type": "integer",
|
||||
"format": "default"
|
||||
},
|
||||
{
|
||||
"name": "link",
|
||||
"type": "string",
|
||||
"format": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "subjects-json",
|
||||
"path": "subjects.json",
|
||||
"title": "{{ site.title | escape }} metadata subject counts in json",
|
||||
"description":"Unique values and counts of metadata subject fields.",
|
||||
"format":"json",
|
||||
"profile": "data-resource"
|
||||
},{% endif %}
|
||||
{% if stubs contains "location" %}
|
||||
{
|
||||
"name": "locations-csv",
|
||||
"path": "subjects.csv",
|
||||
"title": "{{ site.title | escape }} metadata location counts in csv",
|
||||
"description": "Unique values and counts of metadata location fields.",
|
||||
"format":"csv",
|
||||
"profile":"tabular-data-resource",
|
||||
"schema": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "location",
|
||||
"type": "string",
|
||||
"format": "default"
|
||||
},
|
||||
{
|
||||
"name": "count",
|
||||
"type": "integer",
|
||||
"format": "default"
|
||||
},
|
||||
{
|
||||
"name": "link",
|
||||
"type": "string",
|
||||
"format": "default"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "locations-json",
|
||||
"path": "locations.json",
|
||||
"title": "{{ site.title | escape }} metadata location counts in json",
|
||||
"description":"Unique values and counts of metadata location fields.",
|
||||
"format":"json",
|
||||
"profile": "data-resource"
|
||||
},{% endif %}
|
||||
{% if stubs contains "map" %}
|
||||
{
|
||||
"name": "geodata-json",
|
||||
"path": "geodata.json",
|
||||
"title": "{{ site.title | escape }} geographic metadata",
|
||||
"description": "Geojson data containing all objects with lat-longs and associated descriptive metadata.",
|
||||
"format":"json",
|
||||
"profile": "data-resource"
|
||||
},{% endif %}
|
||||
{% if stubs contains "timeline" %}
|
||||
{
|
||||
"name": "timeline-json",
|
||||
"path": "timelinejs.json",
|
||||
"title": "{{ site.title | escape }} timeline metadata",
|
||||
"description": "Time-based metadata formatted for TimelineJS or other applications.",
|
||||
"format":"json",
|
||||
"profile": "data-resource"
|
||||
},{% endif %}
|
||||
{
|
||||
"name": "metadata-csv",
|
||||
"path": "metadata.csv",
|
||||
"title": "{{ site.title | escape }} full metadata in csv",
|
||||
"description": "Complete metadata export for {{ site.title | escape }} objects.",
|
||||
"format":"csv",
|
||||
"profile":"data-resource"
|
||||
},
|
||||
{
|
||||
"name": "metadata-json",
|
||||
"path": "metadata.json",
|
||||
"title": "{{ site.title | escape }} full metadata in json",
|
||||
"description": "Complete metadata export for {{ site.title | escape }} objects.",
|
||||
"format":"json",
|
||||
"profile":"data-resource"
|
||||
}
|
||||
]
|
||||
}
|
||||
20
assets/data/facets.json
Normal file
20
assets/data/facets.json
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
# facets generator
|
||||
# creates a csv of unique values and their counts of fields given in site.data.theme.metadata-facets-fields
|
||||
#
|
||||
# Requires CB's array_count_uniq.rb plugin!
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign fields = site.data.theme.metadata-facets-fields | split: "," -%}
|
||||
{
|
||||
"facets": [
|
||||
{% for f in fields %}{%- assign uniqueArray = items | map: f | join: ";" | downcase | split: ";" | array_count_uniq -%}
|
||||
{
|
||||
"field": {{ f | jsonify }},
|
||||
"terms": { {% for unique in uniqueArray %}
|
||||
{{ unique[0] | jsonify }}: {{ unique[1] | jsonify }}{% unless forloop.last %},{% endunless %}{% endfor %}
|
||||
}
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
24
assets/data/geodata.json
Normal file
24
assets/data/geodata.json
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
# generate geojson data for collection items with lat-longs
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' | where_exp: 'item','item.latitude != nil and item.longitude != nil' -%}
|
||||
{%- assign fields = site.data.theme.metadata-export-fields | split: "," -%}
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{% for item in items %}
|
||||
{
|
||||
"type":"Feature",
|
||||
"geometry":{
|
||||
"type":"Point",
|
||||
"coordinates":[{{ item.longitude }},{{ item.latitude }}]
|
||||
},
|
||||
"properties":{
|
||||
{% for f in fields %}{% if item[f] %}{{ f | jsonify }}: {{ item[f] | jsonify }},{% endif %}
|
||||
{% endfor %}{% if item.image_thumb %}"object_thumb": "{{ item.image_thumb | absolute_url }}",{% endif %}
|
||||
"object_location": "{{ item.object_location | absolute_url }}",
|
||||
"reference_url": "{{ '/items/' | relative_url }}{% if item.parentid %}{{ item.parentid }}.html#{{ item.objectid }}{% else %}{{ item.objectid }}.html{% endif %}"
|
||||
}
|
||||
}{% unless forloop.last %}, {% endunless %}{% endfor %}
|
||||
]
|
||||
}
|
||||
18
assets/data/locations.csv
Normal file
18
assets/data/locations.csv
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# find all unique locations used in the metadata
|
||||
#
|
||||
# Requires CB's array_count_uniq.rb plugin!
|
||||
---
|
||||
{%- if site.data.theme.locations-fields -%}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign locations-fields = site.data.theme.locations-fields | split: ";" -%}
|
||||
{%- assign places = "" -%}
|
||||
{%- for c in locations-fields -%}
|
||||
{% assign new = items | map: c | join: ";" %}
|
||||
{% assign places = places | append: ";" | append: new %}
|
||||
{%- endfor -%}
|
||||
{%- assign uniqPlaces = places | downcase | split: ";" | array_count_uniq -%}
|
||||
location,count,link
|
||||
{% for s in uniqPlaces %}"{{ s[0] }}",{{ s[1] }},"{{ s[0] | url_param_escape | prepend: '/browse.html#' | absolute_url }}"
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 73.
|
18
assets/data/locations.json
Normal file
18
assets/data/locations.json
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# find and count unique subjects
|
||||
#
|
||||
# Requires CB's array_count_uniq.rb plugin!
|
||||
---
|
||||
{%- if site.data.theme.locations-fields -%}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign locations-fields = site.data.theme.locations-fields | split: ";" -%}
|
||||
{%- assign places = "" -%}
|
||||
{%- for c in locations-fields -%}
|
||||
{% assign new = items | map: c | join: ";" %}
|
||||
{% assign places = places | append: ";" | append: new %}
|
||||
{%- endfor -%}
|
||||
{%- assign uniqPlaces = places | downcase | split: ";" | array_count_uniq -%}
|
||||
{ "locations": [
|
||||
{% for s in uniqPlaces %}{ "location" : {{ 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 -%}
|
||||
8
assets/data/metadata.csv
Normal file
8
assets/data/metadata.csv
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
# create custom metadata csv for download
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign fields = site.data.theme.metadata-export-fields | split: "," -%}
|
||||
{{ fields | join: "," }},object_thumb,object_location,reference_url
|
||||
{% for item in items %}{% for f in fields %}"{{ item[f] | escape }}",{% endfor %}"{{ item.image_thumb | absolute_url }}","{{ item.object_location | absolute_url }}",{{ '/items/' | relative_url }}{% if item.parentid %}{{ item.parentid }}.html#{{ item.objectid }}{% else %}{{ item.objectid }}.html{% endif %}
|
||||
{% endfor %}
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 69.
|
15
assets/data/metadata.json
Normal file
15
assets/data/metadata.json
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
# metadata for json export
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{%- assign fields = site.data.theme.metadata-export-fields | split: "," -%}
|
||||
{ "objects": [
|
||||
{%- for item in items -%}
|
||||
{
|
||||
{% for f in fields %}{% if item[f] %}{{ f | jsonify }}: {{ item[f] | jsonify }},{% endif %}
|
||||
{% endfor %}{% if item.image_thumb %}"object_thumb": "{{ item.image_thumb | absolute_url }}",{% endif %}
|
||||
"object_location": "{{ item.object_location | absolute_url }}",
|
||||
"reference_url": "{{ '/items/' | relative_url }}{% if item.parentid %}{{ item.parentid }}.html#{{ item.objectid }}{% else %}{{ item.objectid }}.html{% endif %}"
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
] }
|
||||
18
assets/data/subjects.csv
Normal file
18
assets/data/subjects.csv
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# find all unique subjects used in the metadata
|
||||
#
|
||||
# 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 -%}
|
||||
subject,count,link
|
||||
{% for s in uniqSubjects %}"{{ s[0] }}",{{ s[1] }},"{{ s[0] | url_param_escape | prepend: '/browse.html#' | absolute_url }}"
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 71.
|
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 -%}
|
||||
42
assets/data/timelinejs.json
Normal file
42
assets/data/timelinejs.json
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
# generate time-focused json data suitable for TimelineJS, https://timeline.knightlab.com/docs/json-format.html
|
||||
# includes all items in metadata that have a "date" field filled.
|
||||
# current using relative_url due to jekyll bug, should be absolute_url in production!
|
||||
# to just feature parent objects of compound objects, you will want to change the where_exp below to "where_exp: 'item','item.parentid == nil'"
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' | where_exp: 'item', 'item.date' -%}
|
||||
{
|
||||
"title": {
|
||||
"media": {
|
||||
"url": "{{ site.data.featured_item.src | relative_url }}",
|
||||
"alt": {{ site.data.featured_item.alt | jsonify }},
|
||||
"caption": {{ site.data.featured_item.title | jsonify }},
|
||||
"credit": {{ site.title | jsonify }}
|
||||
},
|
||||
"text": {
|
||||
"headline": {{ site.title | append: ' Timeline' | jsonify }},
|
||||
"text": {{ site.description | jsonify }}
|
||||
}
|
||||
},
|
||||
"events": [
|
||||
{% for item in items %}{
|
||||
"media": {
|
||||
"url": "{{ item.image_small | default: item.image_thumb | default: item.object_location | relative_url }}",
|
||||
"alt": {{ item.image_alt_text | default: item.description | default: item.title | jsonify }},
|
||||
"caption": {{ item.title | jsonify }},
|
||||
"link": "{{ '/items/' | relative_url }}{% if item.parentid %}{{ item.parentid }}.html#{{ item.objectid }}{% else %}{{ item.objectid }}.html{% endif %}"
|
||||
},
|
||||
"start_date": {
|
||||
{% if item.date contains '-' %}{% assign dates = item.date | strip | split: '-' %}
|
||||
"month": "{{ dates[1] }}",
|
||||
"day": "{{ dates[2] }}",
|
||||
"year": "{{ dates[0] }}"{% elsif item.date contains '/' %}"year": "{{ item.date | strip | split: '/' | last }}"{% else %}
|
||||
"year": "{{ item.date }}"{% endif %}
|
||||
},
|
||||
"text": {
|
||||
"headline": {{ item.title | jsonify }}{% if item.description %},
|
||||
"text": {{ item.description | jsonify }}{% endif %}
|
||||
}
|
||||
}{% unless forloop.last %},{% endunless %}{% endfor %}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user