Questions tagged [liquid]

0

votes
0

answer
6

Views

Shopify shipping method - 3rd party Click and collect

I am trying to integrate a 3rd party shipping widget on Shopify Plus. The company we're using, ParcelPoint, do not have an app available in Shopify and so I am using their API & widget. If a customer selects this as their shipping method, they can then select an address from their widget. I am stor...
kaygee
1

votes
0

answer
8

Views

Modify theme.liquid using Shopify assets API

I want to add the below-mentioned code in theme.liquid {{ 'imagesearchlogo.svg' | asset_url | img_tag }} I have tried below-mentioned method in python data={ "asset": { "key": "layout/theme.liquid", "value": ''' {{ 'imagesearchlogo.svg' | asset_url | img_tag }} ''' } } response = requests.put("http...
Arjun Borkhatariya
1

votes
0

answer
13

Views

Shopify liquid How to hide out of stock products until click on element at collection page?

How I can make an element that will hide the "out of stock items" that will be under the stock items and if someone clicks the button, it will open them? I added a photo for example:
Gil s
1

votes
1

answer
562

Views

Shopify - Get product title in liquid?

In the theme settings the end user is able to select a product from a drop down list of all products. This is done in the settings_scheme.json file. [ { { "name": "Home page - Feature Box 2 (Product 1)", "settings": [ { "type": "product", "id": "homepage-grid-product-1" } ] } ] Then using liquid I w...
Dingo Bruce
1

votes
1

answer
185

Views

Shopify Liquid Syntax - What is the difference between {%- assign [some_var] = [some_val] -%} and {% assign [some_var] = [some_val] %}

When coding in Shopify's Liquid language I notice some variables being assigned using the following syntax: {%- assign variable = value -%} and other variables being assigned using the following syntax: {% assign variable = value %} Could someone explain the difference, if there is any?
D3XT3R
1

votes
2

answer
438

Views

Shopify if homepage?

How do I detect shopify if Homepage? Previously there was a handler which was page.frontpage which is not used anymore. I need to exclude something from the homepage, so I can't go for editing the index.liquid file.
1

votes
2

answer
2.2k

Views

Shopify liquid get related blog posts

In shopify I am using liquid templating to get blog posts which are related to products by their tags, like so: {% for article in blogs.blog.articles %} {% if article.tags contains product.handle %} {{ article.title }} {% endif %} {% endfor %} However, if there are no related posts, I would like to...
Sirrah
1

votes
3

answer
2.5k

Views

Nancy Module Unit Testing. Exception in unit test

Can't find reason why test isn't work. Has anybody known why it happen? Difference between these two tests is ony in views. In first it is ".html" page and in second it is ".liquid". In my project I use ".liquid", so ".html" is only for testing correct working test. I have a Nancy Module public seal...
Taras Kravets
1

votes
2

answer
1.8k

Views

How do I make 2 or more horizontal divs stack into a vertical div when the user shrinks the browser window?

I have 2 divs on same row, each with a width of 50% and a float: left. I would like them to stack one on top of the other if the user is viewing the page from a smart-phone. Right now, the divs remain on the same row even if the browser window is narrowed to 300px or if viewed from a smart-phone.
Alex Williams
1

votes
2

answer
97

Views

How to determine the value of a variable extends to one line or several lines?

I am using liquid to format some data into a document. I am fetching the value of a variable and printing it and just after that i want to put a border line. The problem is that if it is of one line then there is no problem but if the {{ business.name }} extends to several lines, then there is p...
Luv
1

votes
1

answer
1.5k

Views

Jekyll break for loop [duplicate]

This question already has an answer here: Is there a “break” tag to escape a loop in Liquid? 1 answer I'm processing site.posts to compare post.categories against page.categories to create a related posts sidebar but if there are multiple common categories I get multiple links. I want to break...
owen79
1

votes
1

answer
9.7k

Views

Shopify Liquid: If Statement

I am trying to enable a div class based on when a user views certain web page eg: blog, index or ../page/webpage The code is like this: {% unless template contains "index" and settings.slideshow_enabled %} {% endunless %} That "container main content" shows an image behind the nav bar. On other page...
Sylar
1

votes
1

answer
470

Views

How to use Jekyll's pagination tool to sort through a subdirectory within _posts

Having trouble getting pagination to work properly in Jekyll using liquid markdown. Used the paginator function and the posts do paginate but I'm trying to figure out a way to filter out what paginates. Within my _posts directory I have a blog sub directory and a news subdirectory. I'm trying to onl...
Noctist
1

votes
1

answer
3.3k

Views

Difference between nil and null in YAML

I'm working on a Liquid template in Jekyll, and I have 2 places where I'm not sure what to use: nil, null, or just empty. In the front matter: --- layout: nil|null| --- When I use nil, I get `Build Warning: Layout 'nil' requested in sitemap.xml does not exist, as this thread demonstrates. null and b...
jasonszhao
1

votes
2

answer
80

Views

Split and copy classes from parent div to adjacent divs (Liquid or jQuery)

I have the following code which uses some Liquid Markup: {{ this.filters | prepend: '' | replace: ',', '' | append: '' }} I have the following filters (1 or all of them may be selected) Mood Boards Outfits Designers Styling Photo Shoots Collaboration News/Events Lets say "Mood Boards", "Designers",...
JHair
1

votes
1

answer
943

Views

Can this be a Bug in Jekyll? ('endfor' unknown tag)

just started using Jekyll today and Im having trouble... Here is my error message: Unknown tag 'endfor' in _includes/masonry.html I see no reason for the error. Please help me! Here is the code jekyll thinks is wrong: {% for item in page.slideshow %} {% if item.caption %}{{ item.caption }}{% endif %...
1

votes
2

answer
922

Views

Access JSON lumps in metafields with Shopify Liquid templates

I was wondering if anyone knew if I can access JSON in Liquid such as the example below. I have created a metafield for the suppliers page with the namespace suppliers_details, with the key suppliers and the value: { name: "Supplier Name One", address: "Supplier Address One" }, { name: "Supplier Nam...
Tom Hamilton Stubber
1

votes
1

answer
456

Views

How should I pass assigned variables to an included Jekyll file?

I use github pages to host a jekyll website. In order to quickly switch beetween the online base URL and the locale base URL, I have a variable in the start of my default layout file: {% assign root = "." %} However, if I try to use that variable in an included file, it doesn't work. I know it shoul...
Billybobbonnet
3

votes
1

answer
873

Views

Jekyll arithmetic in conditional statement

I am trying to do some basic arithmetic in Jekyll's liquid templating engine. I have assigned one variable numColumns and I am trying to use it in a conditional statement. {% assign numColumns = 3 %} Note I omitted the outer for loop in the below expression where loopindex comes from. Regardless, t...
ThisClark
3

votes
1

answer
726

Views

Liquid syntax error for 'gist' tag with github-pages gem for Jekyll

I have a Jekyll site that is hosted on Github Pages. I am trying to get my site to render locally before I push to Github, but I get the following error when running bundle exec jekyll serve --safe: Liquid Exception: Liquid syntax error (line 13): Unknown tag 'gist' My _config.yml contains the follo...
mprat
2

votes
1

answer
940

Views

Liquid error “No such template” in Rails

I'm getting the following error in my Liquid view: Liquid error: No such template 'sliders/slider' # The file structure in my liquid code (which saves in the database) has the following code: {% include 'sliders/slider' %} and in my view where I render the Liquid content is as follows And in app/vi...
sameera207
2

votes
3

answer
1.2k

Views

Liquid - Fixed - Liquid Layout

I'm working on this web-site: http://www.justaddsolutions.com/SampleSite/ The main area is meant to be 1024px wide and always centered, which is achieved. However my client would like the yellow and red strips to extend to the respected edges (yellow to the left and red to the right) of the browser...
hanazair
1

votes
1

answer
1.4k

Views

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

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 wa...
Seyong Cho
2

votes
2

answer
1.3k

Views

css liquid layout with div overflow inside

I'm having trouble in design layout css with div element. Basically my main page layout design is look like the following picture : The red box is the browser screen area. The black box is the content area where the data will included / or loaded via ajax. The green box is the data list which is the...
froditus
1

votes
2

answer
1.9k

Views

Shopify check if Metafield exists?

I'm looking to hide content if the metafields are empty for a product, but right now it's returning it for all pages which means my if statement is broken somewhere. Product Page {% if product.metafields.review %} {% include 'extra-review' %} {% else %} {% endif %} Review Snippet Page (extra-review...
JMKelley
2

votes
1

answer
1.7k

Views

access rails image_tag helper in liquid drop

Does anyone know how to access the image_tag rails helper from within a liquid drop ? Any help / examples would be great as i can't seem to find this anywhere! thanks rick
rick
16

votes
7

answer
6.4k

Views

Locale specific date in jekyll

I am trying out jekyll for website creation. I am using jekyll-bootstrap. The default configuration has the page archive, where all the posts are listed grouped by year and month of the post date. Currently the months appear in English. I've looked at the code and this is an excerpt which is respon...
mpiktas
16

votes
7

answer
6.8k

Views

Capitalize first letter of each word with liquid syntax?

I am trying to set up SEO in a LocomotiveCMS installation using liquid syntax. I'm trying to code it so that the page title is pulled dynamically using {{ page.title }} and then forcing it to capitalize the first letter of each word. I tried this: {{ page.title | camelcase }} | {{ site.name }} Based...
APAD1
17

votes
3

answer
2.8k

Views

Syntax Highlighting with Pygments is failing via Liquid Templates String Error

I'm using Jekyll to convert my markdown and Pygments for syntax highlighting. Here is the error maruku displays: Liquid error: undefined method `join' for "\n song_info = []\n for song in songs:\n song_info.append(song.name) \n":String The markup is as follows: {% highlight python %} song_info = []...
muffs
18

votes
4

answer
3.9k

Views

My jekyll site can't build: Liquid Exception: incompatible character encodings

I do not know what I changed, but today I can no longer build my site's front page with jekyll successfully. It is now complaining about: [2012-10-30 14:22:10] regeneration: 1 files changed Liquid Exception: incompatible character encodings: UTF-8 and ASCII-8BIT in index.html And I'm at a loss to r...
incumbent
18

votes
2

answer
3.2k

Views

How can I get a longer automatic excerpt in Jekyll?

Currently, I include excerpts like this: {{ post.excerpt | strip_html }} But this seems to give only the first paragraph. But I would like to get a fixed number of words. Or better: I would like to define a maximum number of characters and get so many words that the number of characters is less th...
Martin Thoma
18

votes
5

answer
4.9k

Views

How to suppress blank line in Jekyll?

I use GitHub Pages for my blog, and am running into a problem with Jekyll. My post.html has a block like this: {% for testpost in site.posts %} {% four %} {% lines of %} {% processing %} {% goes here %...
James Curran
18

votes
7

answer
11.4k

Views

Using liquid to sort posts alphabetically

Is there a way to sort a number of posts alphabetically, using Jekyll? I have something like this now: {% for post in site.categories.threat %} {{ post.title }} {% endfor %} It works, but the posts are jumbled up. Would look much nicer if they were sorted alphabetically I think. Thanks
Jacques Tardie
0

votes
2

answer
16

Views

adding sections to first and last in for loop containing sections

First of all, I use Plate CMS(runs on shopify liquid), this is creating the sections you can see in the image above. Now im struggeling with a small problem. I want to loop all 6 sections but only 4 of them are placed inside a div and the other 2(the header and footer) are so called tray's, meaning...
Ramon de Vries
2

votes
2

answer
1.3k

Views

Liquid templates - accessing members by name

I'm using Jekyll to create a new blog. It uses Liquid underneath. Jekyll defines certain "variables": site, content, page, post and paginator. These "variables" have several "members". For instance, post.date will return the date of a post, while post.url will return its url. My question is: can I a...
kikito
3

votes
1

answer
71

Views

Jekyll: Can an included snippet know where it came from?

We have a large document that's been put online using jekyll and github pages. When we first made it, we probably went a bit overboard in breaking it up into small bits of content. We used include everywhere. The intent was that loads of people could contribute to it, but its structure is a bit too...
Ben
1

votes
1

answer
2.7k

Views

Evaluate a liquid “if” statement based on value of liquid filter

I have a custom Liquid filter I use in a Jekyll site, {{ page.url | git_modified }} Which generates the modification date from the git log (plugin code here). Often I may add the additional filter to convert this to a string or XML schema, depending on context, e.g. {{ page.url | git_modified | da...
cboettig
2

votes
2

answer
528

Views

Detect user agent jekyll

I would like to render different html for desktop and mobile on jekyll. I need something like: {% if is_mobile %} {% else %} (% endif %} Obviously I could just use javascript in the browser to determine this but I don't want to render the extra html for mobiles. Maybe I could create a jekyll plugin...
david_adler
2

votes
1

answer
62

Views

Page frontmatter assign to site frontmatter in Jekyll

How do I use a variable from the site _config.yml in a posts frontmatter? I would like to do something like --- github-id: site.github-id --- However this literally sets it to the string "site.github-id".
Jacob Tomlinson
3

votes
2

answer
135

Views

Create a template and replace placeholders dynamically in Ruby On Rails

I have a set template in which there is address informations and other set of user information. I have created a html file in the public folder and load the file at runtime and use template = File.read("public/filename.html") template % {key:value} to replace the tokens with actual value and proces...

View additional questions