├── .github └── FUNDING.yml ├── random-number.liquid ├── json-ld-search.liquid ├── json-ld-organization.liquid ├── LICENSE ├── random-product.liquid ├── metadata-twitter.liquid ├── metadata-og.liquid ├── README.md └── json-ld-product.liquid /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: pgrimaud 4 | custom: https://www.paypal.me/grimaudpierre 5 | -------------------------------------------------------------------------------- /random-number.liquid: -------------------------------------------------------------------------------- 1 | {%- comment -%} 2 | Wanna change the range, just edit line 10 & 11 3 | 4 | Basic usage : 5 | {% render 'random-test' %} 6 | {{ random_number }} -> here's your random number 7 | {%- endcomment -%} 8 | 9 | {%- assign min = 0 -%} 10 | {%- assign max = 9999999 -%} 11 | {%- assign diff = max | minus: min -%} 12 | {%- assign random_number = "now" | date: "%N" | modulo: diff | plus: min -%} 13 | -------------------------------------------------------------------------------- /json-ld-search.liquid: -------------------------------------------------------------------------------- 1 | {%- comment -%} 2 | Nothing to do, just : {% render 'json-ld-search' %} 3 | {%- endcomment -%} 4 | 5 | 17 | -------------------------------------------------------------------------------- /json-ld-organization.liquid: -------------------------------------------------------------------------------- 1 | {%- comment -%} 2 | You have to change the logo asset on line 11. 3 | Also change social links started at line 13, with as many links you need. 4 | {%- endcomment -%} 5 | 6 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Pierre Grimaud 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /random-product.liquid: -------------------------------------------------------------------------------- 1 | {%- comment -%} 2 | Basic usage to get a random product from all your shop : 3 | {%- render 'random-product' -%} 4 | {{ random_product }} -> here's your random product 5 | 6 | Basic usage to get a random product from a specific collection : 7 | {%- render 'random-product' with specific_collection: 'sport' -%} 8 | {{ random_product }} -> here's your random product 9 | {%- endcomment -%} 10 | 11 | {%- if specific_collection -%} 12 | {%- assign all_products_from_collection = collections[specific_collection].products -%} 13 | {%- else -%} 14 | {%- assign all_products_from_collection = collections['all'].products -%} 15 | {%- endif -%} 16 | 17 | {%- assign all_products_random = '' -%} 18 | 19 | {%- for product_splitted in all_products_from_collection -%} 20 | {%- assign all_products_random = all_products_random | append: product_splitted.handle | append: ',' -%} 21 | {%- endfor -%} 22 | 23 | {%- assign all_products_random_splited = all_products_random | split: ',' -%} 24 | 25 | {%- assign min = 0 -%} 26 | {%- assign max = all_products_random_splited.size | minus: 1 -%} 27 | {%- assign diff = max | minus: min -%} 28 | {%- assign random_number = "now" | date: "%N" | modulo: diff | plus: min -%} 29 | 30 | {%- assign random_product_slug = all_products_random_splited[random_number] -%} 31 | {%- assign random_product = all_products[random_product_slug] -%} 32 | -------------------------------------------------------------------------------- /metadata-twitter.liquid: -------------------------------------------------------------------------------- 1 | {%- comment -%} 2 | You have to change the Twitter handle line 6. 3 | You have to change the logo asset on line 35. It must be a square picture. 4 | {%- endcomment -%} 5 | 6 | 7 | 8 | {% if template contains 'product' %} 9 | 10 | 11 | 12 | 13 | 14 | 15 | {% if product.vendor == blank %} 16 | 17 | 18 | {% else %} 19 | 20 | 21 | {% endif %} 22 | {% elsif template contains 'article' %} 23 | 24 | 25 | 26 | {% assign img_tag = '<' | append: 'img' %} 27 | {% if article.content contains img_tag %} 28 | {% assign src = article.content | split: 'src="' %} 29 | {% assign src = src[1] | split: '"' | first | remove: 'https:' | remove: 'http:' %} 30 | {% if src %} 31 | 32 | {% endif %} 33 | {% endif %} 34 | {% else %} 35 | 36 | {% endif %} 37 | -------------------------------------------------------------------------------- /metadata-og.liquid: -------------------------------------------------------------------------------- 1 | {%- comment -%} 2 | You have to change the logo asset on line 32 & 33. 3 | {%- endcomment -%} 4 | 5 | {%- if template contains 'product' -%} 6 | 7 | 8 | 9 | {%- for image in product.images limit:3 -%} 10 | 11 | 12 | {%- endfor -%} 13 | 14 | 15 | 16 | 17 | {%- elsif template contains 'article' -%} 18 | 19 | 20 | {%- assign img_tag = '<' | append: 'img' -%} 21 | {%- if article.content contains img_tag -%} 22 | {%- assign src = article.content | split: 'src="' -%} 23 | {%- assign src = src[1] | split: '"' | first | remove: 'https:' | remove: 'http:' -%} 24 | {%- if src -%} 25 | 26 | 27 | {%- endif -%} 28 | {%- endif -%} 29 | {%- else -%} 30 | 31 | 32 | 33 | 34 | {%- endif -%} 35 | {%- if page_description and template != 'product' -%} 36 | 37 | {%- endif -%} 38 | 39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
