liquid

Shopify Liquid: If Statement

对着背影说爱祢 提交于 2019-12-02 05:06:50
问题 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 %} <div class="container main content"> {% endunless %} That "container main content" shows an image behind the nav bar. On other pages, the image starts from below the nav bar. A clear example here: http://retina-theme.myshopify.com/ I want to have that same homepage, link the link above, on

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

非 Y 不嫁゛ 提交于 2019-12-02 04:23:45
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. Media queries is the way to go. I'd go with a mobile-first approach, and add media queries to scale up the design. I.e, start with the divs not floating, and add float and width when the screen estate reaches a certain size: <!-- HTML --> <div class="wrapper"> <div class="column"> <p>This is column 1<

parsing tab delimited file in javascript

人盡茶涼 提交于 2019-12-02 03:49:16
问题 I can't change the server side, but I'm getting a file that looks like this: 0 20.59339 138402 1 11.20062 75276 2 32.07597 215573 3 12.2029 82012 4 6.800035 45701 5 0.6548425 4401 6 0.8643445 5809 7 0.7174848 4822 8 0.813457 5467 9 0.7198655 4838 10 0.8152425 5479 11 1.396878 9388 12 1.93953 13035 13 4.410404 29641 14 1.392266 9357 15 0.7592959 5103 16 1.040368 6992 17 1.603107 10774 I have Liquid, javascript, and jquery at my disposal. From Liquid, I shoved the contents into a div with no

Shopify Liquid: If Statement

自作多情 提交于 2019-12-02 00:35:49
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 %} <div class="container main content"> {% endunless %} That "container main content" shows an image behind the nav bar. On other pages, the image starts from below the nav bar. A clear example here: http://retina-theme.myshopify.com/ I want to have that same homepage, link the link above, on selected pages or template: {% if template == "index" and template == "page" and settings.slideshow

Jekyll Liquid - accessing _config.yml dynamically

烈酒焚心 提交于 2019-12-01 22:58:01
问题 For internationalizing my app I need to be able to dynamically access entries in a YAML file. It is best explained with an example: Page: --- layout: default title: title_homepage --- This will then allow access to the title_homepage variable in the Default Layout Template: Default Layout: page.title = "title_homepage" Now normally I would access my _config.yml file like this: {{ site.locales[site.default_locale].variable }} However, now for this to work, I need to access the _config.yml with

Can I have a proper nice tiled pagination in Jekyll using Liquid templates?

依然范特西╮ 提交于 2019-12-01 22:47:12
I've found this nice jekyll theme: http://www.jacoporabolini.com/emerald/ with good looking pagination. Unfortunately is only good looking when there is a small number of pages. In case of my blog this looks like this: Not surprisingly because the code looks like this: {% for page in (1..paginator.total_pages) %} And it should like more like this: {% for page in (min(1,paginator.page-3)..max(paginator.page+3,paginator.total_pages)) %} The problem is, I don't think there is something like min and max in Liquid or even arithmetic operators like + or - . I was searching though the documentation

Concatenate arrays in liquid

感情迁移 提交于 2019-12-01 22:19:02
问题 I am trying to concatenate three arrays in liquid/jekyll but in the final array (publications) I get only the elements of the first one (papers) {% assign papers = (site.publications | where:"type","paper" | sort: 'date') | reverse %} {% assign posters = (site.publications | where:"type","poster" | sort: 'date') | reverse %} {% assign abstracts = (site.publications | where:"type","abstract" | sort: 'date') | reverse %} {% assign publications = papers | concat: posters | concat: abstracts %}

Jekyll Liquid - accessing _config.yml dynamically

耗尽温柔 提交于 2019-12-01 20:31:48
For internationalizing my app I need to be able to dynamically access entries in a YAML file. It is best explained with an example: Page: --- layout: default title: title_homepage --- This will then allow access to the title_homepage variable in the Default Layout Template: Default Layout: page.title = "title_homepage" Now normally I would access my _config.yml file like this: {{ site.locales[site.default_locale].variable }} However, now for this to work, I need to access the _config.yml with the value of page.title. This will not work: {{ site.locales[site.default_locale].page.title }} I need

Accessing _data in Jekyll (loop in loop)

痞子三分冷 提交于 2019-12-01 19:46:00
Given this YAML: - maincategory: title: "Projects" subcategory: title: "General" item: title: "Alpha" item: title: "Beta" - maincategory: title: "Support" subcategory: title: "General" item: title: "Something" item: title: "Else" How would one iterate over this data if the Jekyll _data file is called entries.yml? So far I've gotten here but I'm not sure whether I should keep referencing the site.data oject in sub-loops. Also not sure whether this is even possible. {% for entry in site.data.entries %} <h2>{{ entry.maincategory.title }}</h3> {% for subcategory in site.data.entries.maincategories

Howto check if current visitor is shop's admin?

一世执手 提交于 2019-12-01 17:58:41
I would like to create a product that would be available in Shopify's storefront but would only be accessible for the shop administrator. Is there anyway to identify if the current user is an admin via liquid? or is there any other solution for this challenge. Thanks! If you're signed in as an admin, when rendering the {{ content_for_header }} include, it will contain some JavaScript to push the page content down to make room for the Shopify admin bar. We can utilize capture to store the {{ content_for_header }} code as a liquid variable and then use the contains operator to check if admin_bar