Skip to content

Instantly share code, notes, and snippets.

@pbinkley
Created May 5, 2021 04:03
Show Gist options
  • Save pbinkley/8da3e349dd8fbc8a3421c6b02996a3de to your computer and use it in GitHub Desktop.
Save pbinkley/8da3e349dd8fbc8a3421c6b02996a3de to your computer and use it in GitHub Desktop.
Mirador demo page for Wax sites
title layout
Mirador
default

{% assign iiif_collections = site.collections | where_exp: "coll", "coll['images']['source']" %} {% assign default_collection = iiif_collections[0]['label'] %} {% assign default_item = site.data[default_collection][0]['pid'] %}

<script>document.write("<script type='text/javascript' src='https://mirador-dev.netlify.app/dist/mirador.min.js'><\/script>");</script> <script type="text/javascript"> const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); var itemId = urlParams.get('itemId'); var imageId = urlParams.get('imageId');

itemId = itemId || '{{ default_item }}'

var windowConfig = { manifestId: '{{ "/" | absolute_url }}img/derivatives/iiif/' + itemId + '/manifest.json' }

if (imageId) { windowConfig['canvasId'] = '{{ "/" | absolute_url }}img/derivatives/iiif/canvas/' + itemId + '_' + imageId + '.json' }

var miradorInstance = Mirador.viewer({ id: 'mirador', theme: { transitions: window.location.port === '4488' ? { create: () => 'none' } : {}, }, windows: [windowConfig], workspace: { showZoomControls: true }, catalog: [ {% for c in iiif_collections %} {% for m in site.data[c['label']] %} { manifestId: "{{ '/' | absolute_url }}{{ m['manifest'] }}" }, {% endfor %} {% endfor %} ] }); </script>

@pbinkley
Copy link
Author

pbinkley commented May 5, 2021

Drop this file in the root directory of a Wax site. You can then visit it at http://localhost:4000/wax/mirador/ . It builds a catalog of the manifests in the site (click the blue plus at upper left). For a wax themed site with the Qatar demo objects, these links work to open specific manifest and specific canvases:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment