Skip to content
Johann Barbie edited this page Oct 25, 2015 · 15 revisions
  1. Open up your Shopify Admin interface at:

    https://<shopname>.myshopify.com/admin/themes
    

    On your installed theme, select "Customize Theme" -> "Theme Options" -> "Edit HTML/CSS".

  2. In the Folder "Assets", open scripts.js.liquid for editing and add following code to the file:

//PROVENANCE
(function(hookEl, findSlugEl) {
  'use strict';

  //search dom and check preconditions
  var slugRegEx = /.*\/stories\/([\w-]*)/;
  var el = $(findSlugEl).find('[href*="provenance.org"]')[0];
  var slug = (el) ? $(el).attr('href').match(slugRegEx)[1] : undefined;
  if (!slug || $(hookEl).length === 0) {
    return;
  }

  //insert new element
  var newEl = $('<div class="section provenance-StoryCard" data-slug="' + slug + '"></div>');
  newEl.insertAfter(hookEl);

  //load javascript
  $.getScript('//drj5wi2x4lz96.cloudfront.net/js/prov.min.js');

  //remove data element
  $(el.parentNode).remove();
})('div.space-under', 'div.product-description');
  1. Save file, and verify functionality. Make sure you test a product with a linked story.
Clone this wiki locally