Snippets

Team Headjam Creative BC Liquid Snippets

Updated by James Nowland

File Video Tag - Remove Extension Added

  • Ignore whitespace
  • Hide word diff
+{% assign homepageVideoExtension = homepage['Hero Video'] | split: '.' | last | prepend: '.'  -%}
+<video class="Video"
+       data-object-fit="cover"
+       poster="{{ homepage['Hero Video'] | remove: homepageVideoExtension }}.jpg"
+       muted autoplay playsinline webkit-playsinline loop
+ >
+  <source src="{{ homepage['Hero Video'] | remove: homepageVideoExtension }}.mp4" type="video/mp4">
+  <source src="{{ homepage['Hero Video'] | remove: homepageVideoExtension }}.webm" type="video/webm">
+</video>
Updated by James Nowland

File Convert 24hr to 12hr time Added

  • Ignore whitespace
  • Hide word diff
+{% for item in gv_site.operatingHours %}
+  <dt class="OpeningHours-day">{{ item['day'] | capitalize | slice: 0, 3 }}</dt>
+  <dd class="OpeningHours-time">
+
+    {% comment %}Convert 24 hour time to 12 hour time{% endcomment %}
+    {% assign openTime = item['opens'] | split: ':' -%}
+    {% assign closeTime = item['closes'] | split: ':' -%}
+
+    {% if openTime[0] < 13 -%}
+        {{ item['opens'] | replace: ':00' }}am
+    {% elseif closeTime[0] == 12 -%}
+      {{ item['opens'] | replace: ':00' }}pm
+    {% else %}
+      {{ openTime[0] | minus: 12 }}{{ openTime[1] | prepend: ':' | replace: ':00' }}pm
+    {% endif -%}
+
+    &ndash;
+
+    {% if closeTime[0] < 12 -%}
+      {{ item['closes'] | replace: ':00' }}am
+    {% elseif closeTime[0] == 12 -%}
+      {{ item['closes'] | replace: ':00' }}pm
+    {% else %}
+      {{ closeTime[0] | minus: 12 }}{{ closeTime[1] | prepend: ':' | replace: ':00' }}pm
+    {% endif -%}
+  </dd>
+{% endfor %}
Updated by James Nowland

File Schema - Restaurant - Opening House Modified

  • Ignore whitespace
  • Hide word diff
   <script type="application/ld+json">
     {
-      "@id": "{{ gv_site.domain }}",
       "@context": "http://schema.org",
       "@type": "Restaurant",
       "address": {
Updated by James Nowland

File Schema - Restaurant - Opening House Added

  • Ignore whitespace
  • Hide word diff
+  <script type="application/ld+json">
+    {
+      "@id": "{{ gv_site.domain }}",
+      "@context": "http://schema.org",
+      "@type": "Restaurant",
+      "address": {
+        "@type": "PostalAddress",
+        "addressLocality": "{{ gv_site.locations[0]['suburb'] }}",
+        "addressRegion": "{{ gv_site.locations[0]['state'] }}",
+        "postalCode": "{{ gv_site.locations[0]['postcode'] }}",
+        "streetAddress": "{{ gv_site.locations[0]['address1'] }}"
+      },
+      "geo": {
+        "@type": "GeoCoordinates",
+        "latitude": {{ gv_site.locations[0].latitude }},
+        "longitude": {{ gv_site.locations[0].longitude }}
+      },
+      "acceptsReservations": "No",
+      "url": "{{ gv_site.domain }}",
+      "name": "{{ gv_site.name }}",
+      "image": "{{ gv_site.domain }}/theme/dist/img/branding/logo.png",
+      "description": "{{ currentPageCollection['seoMetadataDescription'] }}",
+      "telephone": "{{ gv_site.locations[0]['phone'] | replace: ' ','' | replace: '(', '' | replace: ')', '' }}",
+      "priceRange": "$",
+      "servesCuisine": [
+        {% for menu in menus.items -%}
+        "{{ menu['Title'] }}"{% unless forloop.last -%},{% endunless %}
+        {% endfor -%}
+      ],
+      "menu": "{{ gv_site.domain }}/#menu",
+      "openingHoursSpecification": [
+        {% for item in gv_site.operatingHours -%}
+          {
+            "@type": "OpeningHoursSpecification",
+            "dayOfWeek": "{{ item.day }}",
+            "opens": "{{ item.opens }}",
+            "closes": "{{ item.closes }}"
+          }{% unless forloop.last -%},{% endunless %}
+        {% endfor %}
+      ],
+      "sameAs" : [
+      {% for menuSocial in gv_site.social -%}
+        "{{ menuSocial[1] }}"{% unless forloop.last -%},{% endunless %}
+      {% endfor -%}
+      ]
+    }
+  </script>
Updated by James Nowland

File Get Current Page Details Added

  • Ignore whitespace
  • Hide word diff
+{module_data resource="pages" version="v3" fields="pageUrl,name,title,seoMetadataDescription" resourceId="{module_oid}" skip="0" limit="1" order="id" collection="currentPageCollection"}
+{% assign pageDetail = currentPageCollection[0] -%}
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.