liquid

Adding days to a date excluding weekends in Shopify

帅比萌擦擦* 提交于 2020-06-26 08:46:56
问题 I'm trying to write some code to estimate a shipping date in Shopify. I've been learning liquid but am having trouble writing some logic in Ruby. I'm not sure if Shopify templates use Ruby or Ruby on Rails. I want to get todays date and add either 3 or 5 days based on a input variable, excusing weekends. Heres how I'd do it in PHP: $orderDate = date('Y-m-d'); $personalized = true; $orderDays = ($personalized ? 4 : 2); (date('H') > 12 ? $orderDays++ : $false); $d = new DateTime( $orderDate );

Adding days to a date excluding weekends in Shopify

╄→гoц情女王★ 提交于 2020-06-26 08:46:33
问题 I'm trying to write some code to estimate a shipping date in Shopify. I've been learning liquid but am having trouble writing some logic in Ruby. I'm not sure if Shopify templates use Ruby or Ruby on Rails. I want to get todays date and add either 3 or 5 days based on a input variable, excusing weekends. Heres how I'd do it in PHP: $orderDate = date('Y-m-d'); $personalized = true; $orderDays = ($personalized ? 4 : 2); (date('H') > 12 ? $orderDays++ : $false); $d = new DateTime( $orderDate );

How to fix “StackLevelError (Stack Overflow)” in Jekyll navigation template

空扰寡人 提交于 2020-05-15 08:12:03
问题 I am trying to write a recursive Jekyll navigation template (include) as described in "Nested tree navigation with recursion". I have a minimal example committed in jekyll-min, which basically has: two top-level dirs, each with one page another dir under the second top-level dir, containing one page a navigation template ( _includes/docs_contents.html ) that loops through the top-level dirs and initiates recursive traversal for each a recursive include ( _includes/nav.html ) that accepts a

Using filters in Liquid tags

随声附和 提交于 2020-05-10 06:57:47
问题 I'm using jekyll and Liquid to generate a static web site on github pages. I want to base some content decisions on whether the amount of content in a document has reached a specific number of works. jekyll has a liquid filter which counts the number of words which I want to use in an if tag. I've tried this: {% if page.content | number_of_words > 200 %} ... {% endif %} But it doesn't seem to work. I've also tried to assign the result to a variable and use that, and capture the output from

Using vue.js in Shopify liquid templates

房东的猫 提交于 2020-05-10 04:20:05
问题 This should be simple but despite searching I was unable to find any solution to this. How do you use vue template tags within a liquid file? Since both Vue and liquid use the same curly brackets, I'm unable to render any of my view data: <img src="{{ product.featured_image }}" /> results in: <img src> There are 36 products in my parent view component. When I try to use custom delimiters: new Vue({ delimiters: ['@{{', '}}'], It won't parse with Vue: GET https://inkkas.com/collections/@ 404

Liquid dynamic filename is not accepted

拜拜、爱过 提交于 2020-03-06 03:13:54
问题 When i use {% include folder1/folder1_1/img.jpg %} it works perfectly, But when i try to generate the filename dynamically let's say : {%capture filename %} {{'folder1/folder1_1/'}}{{ images[0] }}{{ '.jpg' }}{% endcapture %} {% include {{ filename }} %} with images[0] = 'img' for example, i get the error that says : Liquid Exception: Invalid syntax for include tag. File contains invalid characters or sequences ... I Don't understand why including file by providing the complete path(static

Liquid dynamic filename is not accepted

蹲街弑〆低调 提交于 2020-03-06 03:13:10
问题 When i use {% include folder1/folder1_1/img.jpg %} it works perfectly, But when i try to generate the filename dynamically let's say : {%capture filename %} {{'folder1/folder1_1/'}}{{ images[0] }}{{ '.jpg' }}{% endcapture %} {% include {{ filename }} %} with images[0] = 'img' for example, i get the error that says : Liquid Exception: Invalid syntax for include tag. File contains invalid characters or sequences ... I Don't understand why including file by providing the complete path(static

How to insert HTML via include in Liquid?

浪子不回头ぞ 提交于 2020-03-05 00:33:22
问题 I have a Jekyll website that uses Liquid Template Engine. In this website, I have a html file called alert.html : <div class="alert"> {{ include.content }} </div> And, in my markdown files when I include the above html like below it works fine: {% include alert.html content="Some important text." %} However, when I try to pass in some HTML, it gets rendered as plain text: {% include alert.html content="<strong>Note:</strong> Some important text." %} I also tried to do the same with capture

How to insert HTML via include in Liquid?

感情迁移 提交于 2020-03-05 00:27:55
问题 I have a Jekyll website that uses Liquid Template Engine. In this website, I have a html file called alert.html : <div class="alert"> {{ include.content }} </div> And, in my markdown files when I include the above html like below it works fine: {% include alert.html content="Some important text." %} However, when I try to pass in some HTML, it gets rendered as plain text: {% include alert.html content="<strong>Note:</strong> Some important text." %} I also tried to do the same with capture

How can I build a gallery tag for Jekyll?

六眼飞鱼酱① 提交于 2020-01-25 11:33:27
问题 I would like to use a gallery tag in Jekyll like this: {% gallery columns="2" %} ../images/2013/12/image.png "This is one caption" ../images/2013/12/bli.png "Another caption" ../images/2014/01/bla.png ../images/2013/12/blup.png "The other one has no caption." {% endgallery %} which should give a gallery like this: I've tried module Jekyll class GalleryTag < Liquid::Tag def initialize(tag_name, text, tokens) super @text = text @tokens = tokens end def render(context) lines = @text.split("\n")