Skip to content

Instantly share code, notes, and snippets.

View tomblanchard's full-sized avatar

Tom Blanchard tomblanchard

View GitHub Profile
@tomblanchard
tomblanchard / product.temporary.liquid
Created May 29, 2020 09:10
/templates/product.temporary.liquid
{% layout 'redirect' %}
{
"namespace" : "seo",
"key" : "hidden",
"value" : 1,
"value_type" : "integer"
}
@tomblanchard
tomblanchard / redirect.liquid
Created May 29, 2020 08:59
/layout/redirect.liquid
<!DOCTYPE html>
<html class="template-{{ template | handle }}" lang="{{ shop.locale }}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="refresh" content="0; url=/" />
{{ content_for_header }}
</head>
var express = require('express');
var cors = require('cors');
var Shopify = require('shopify-api-node');
var app = express();
var port = 3000;
// Shopify API
var shopify = new Shopify({
shopName: 'liquify-scripts',
{% assign google_analytics_id = nil %}
{% if content_for_header contains "ga('create', '" %}
{% assign google_analytics_id = content_for_header | split: "ga('create', '" | last | split: "'" | first | strip %}
{% endif %}
{% if google_analytics_id %}
<p>My Google Analytics ID is: {{ google_analytics_id }}</p>
{% endif %}
var element = document.querySelector('[data-module-language-selector]');
if (element) {
element.addEventListener('change', (event) => {
window.location = event.target.value;
});
}
@tomblanchard
tomblanchard / shopify-encapsulated-components.md
Last active April 24, 2017 04:27
Shopify: Encapsulated components.

Concept

In React (JSX), you create a component like so:

function Button(props) {
  return (
    <button className={"button " + (props.color ? props.color : '')} type="button">
      {props.value}
    </button>

Shopify Custom HTML Email

Installation

Images

Start by uploading the contents of the email/img directory to your theme assets folder, you can do this via the admin page by clicking the active theme Edit HTML/CSS button, expanding the Assets folder tree and clicking Add a new asset.

HTML

@tomblanchard
tomblanchard / instagram-feed.html
Created December 6, 2014 21:00
Instagram feed.
<ul class="instagram__items"></ul>