liquid

Category Page in Jekyll

拈花ヽ惹草 提交于 2019-12-12 04:58:37
问题 I have a category.html page that will loop through a certain category of posts. {% for post in site.categories.tech %} What I want to display is from the index.html page, when the user clicks {{ post.categories }} Which is generated from a loop that displays all of the posts. {% for post in site.posts %} I need that {{ post.categories }} variable to replace the .tech in the categories.html like this {% for category in site.categories.{{ post.categories }} %} I don't know how to pass the

Metafields in Shopify: Trying to display Final Sale message for products that are 60% off

限于喜欢 提交于 2019-12-12 04:12:25
问题 In my customized Shopify theme, a "Final Sale" message displays for any product that is 70% off using the following code: {% assign finalSale = product.metafields.details.final_sale | upcase %} {% if finalSale == 'TRUE' %} <p style="color: #B21F1F;"> This item is final sale -- no returns or exchanges are accepted. </p> {% endif %} I am trying to change this so it displays the Final Sale message when the product is 60% off. My theme is using the Metafields 2 app and I do see the active

Using Jekyll how can I check if file exist in my folder?

谁说胖子不能爱 提交于 2019-12-12 03:46:47
问题 I have an _includes folder, and within it I have nav subfolder containing a nav.html file. I've been trying to check if nav.html exists in nav . If it does, I want to include that nav.html file. If it doesnt exist, there will be a default nav for my template. Here's the code I have right now: {% for static_file in site.static_files %} {% if static_file.path == '/nav.html' %} {% include nav.html %} {% endif %} {% endfor %} Hope you guys can help me out. Many thanks in advance 回答1: I am not

shopify click on different button will run different liquid code

依然范特西╮ 提交于 2019-12-12 03:36:25
问题 If a user click on a button which has class name: '3-col', it will execute the following code: '{% assign products_per_row = "3" %}'. and if a user click on a '4-col' button, it will execute the following code: '{% assign products_per_row = "4" %}'. However the code below doesn't work. I have researched all ways to do that, but I couldn't. Any advice is appreciated. Thanks! <button class='3-col' onclick="prod3()"></button> <button class='4-col'onclick="prod4()" ></button> {% include 'product

Dictionaries and DotLiquid

家住魔仙堡 提交于 2019-12-12 03:11:41
问题 I have a basic .NET Dictionary (Dictionary). In my ToLiquid method I do indeed serialize/expose the Dictionary object. My question is how can I ITERATE over the keys in a liquid template just as you would do in regular .NET? It seems as though you MUST know the actual key in order to access the value in the liquid template. I understand that you could access the value in the liquid template like such item.dictionary["myKey"] However I don't know the actual key, so I would prefer to use the

Check if current customer is an admin in Shopify?

不想你离开。 提交于 2019-12-12 01:57:50
问题 I would like to add a conditional on some pages in my Shopify theme that displays more info if the user viewing the page is an admin (and is logged in). Is there a way to do this? The obvious way is to check the customer.email property against some hard-coded values that belong to admins. But that's a maintenance headache and a poor design. Is there a better way? Thanks. 回答1: There is no list of Shop accounts available to check against. The only check you could make against is the shop email

Shopify: Getting highest price item from collection

末鹿安然 提交于 2019-12-12 01:39:36
问题 Does anyone know how I could get the highest price product from a category? It would be better if it was via Liquid, but if its with JavaScript its ok as well. Any ideas are welcome :P I only need to get the highest price item on a category. Ive stumbled upon the next liquid code: {% assign products = collection.products | sort: 'price' %} {% for product in products %} <h4>{{ product.title }}</h4> {% endfor %} But I cant seem to get this working to sort by price-descending. Is there a way to

Tying mandatory agreement in Shopify ../cart page to multiple products

匆匆过客 提交于 2019-12-11 16:27:39
问题 I've added a mandatory acknowledgment to my Shopify cart page that is displayed when I'm running pre-order sales for certain products. {% for item in cart.items %} {% if item.product.tags contains 'DECEMBER' %} <div class="sixteen columns"> <p style="float:none; text-align:left; clear: both; margin: 10px 0;"> <input style="float:none; vertical-align:middle;" type="checkbox" id="agree" /> <label style="display:inline; float:none" for="agree"> <b>I acknowledge that Company Name will charge my

Shopify (liquid): Find number of days between two dates

随声附和 提交于 2019-12-11 13:31:16
问题 I am new to Shopify and .liquid files syntax. I can get two dates currently: {% assign product_created_date = product.created_at | date: "%a, %b %d, %y" %} {% assign current_date = 'now' | date: "%a, %b %d, %y" %} which gives me the current date and also the date when the product was created. I want to show the users in the theme, the date since the product was posted. I've read some liquid filters and did some search but couldn't find out exactly how I would find the days since product was

Jekyll - Couldn't find file '' in `index.html`

杀马特。学长 韩版系。学妹 提交于 2019-12-11 13:25:20
问题 I added the meta data for the videos to be displayed on the home page as follows: index.html: --- layout: default title: lorem ipsum description: | loren ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque rutrum lacus sed quam pulvinar cursus. Fusce dictum dolor. animVideo: mp4: /videos/Satoshi-intro.mp4 webm: /videos/Satoshi-intro.webm ogv: /videos/Satoshi-intro.ogv poster: /videos/Satoshi-intro.png (...more data) --- {% include hero-slider.html %} <div class="section text