liquid

How to async or defer JS in Liquid?

不羁的心 提交于 2019-12-08 09:48:36
问题 I'm trying to improve site speed, and one thing that might be delaying render are these scripts: {{ '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js' | script_tag }} {{ 'jGestures.min.js' | asset_url | script_tag }} {{ 'modernizr.min.js' | asset_url | script_tag }} How can they be made to asych or defer? Or should I simply move them to the bottom? Also I have not made changes like this to my theme yet. Is it easy to revert changes in Shopify? I would just change it to the way it

Resolve liquid variable inside liquid tag

会有一股神秘感。 提交于 2019-12-08 09:10:56
问题 I'm using Octopress, which is a framework for Jekyll to render my site. I'm using a plugin which wraps the ruby-aaws gem, allowing queries to Amazon using Amazon's product identifier (asin). I'd like to render a portion of the page recusively, looping through a list of asins to produce the output. Here's my code so far: <section> <h1>Recent Diversions</h1> {% for asin in ["044656432X", "0743276396", "B001YT048E"] %} {% capture a_image %}{{ asin | amazon_medium_image }}{% endcapture %} {%

How do I display all of my products on my home page using Shopify and Liquid?

笑着哭i 提交于 2019-12-08 07:59:30
问题 Is there a simple snippet of Liquid markup I can use on my index.liquid page (home page) to display all of the products that I have and make each of those images a link to the respective product's information page? 回答1: Most themes display a collection on their home page. Go with that functionality, don't add code. For your home page collection to include all products in your store, make it a smart collection with a condition such as Product Price > 0. If you have more than 50 products in

Liquid tag for custom linking

依然范特西╮ 提交于 2019-12-08 04:14:18
问题 I am starting to use Jekyll and Liquid and I have some trouble about it. Suppose I want to do some Liquid tag inside Jekyll that makes links: when writing ...and according to {% cite my_link %} we have that... then Jekyll searches the post whose caption (some YAML predefined information) is my_link and creates a link for it according to some style. To create this Liquid tag I suppose one has to start with something like module Jekyll class Cite < Liquid::Tag def render(context) caption = ????

How can I change a variable in Jekyll _config.yml dynamically?

那年仲夏 提交于 2019-12-08 02:53:14
问题 Hi I'm working on a Jekyll project and I need to put a variable in _config.yml that I want to change dynamically from the template code. This is what I want to do, but I can't get it to work. Is it possible to do this? In _config.yml: my_var: "value" In template.html: {% site.my_var = "newvalue" %} {% case site.my_var %} {% when "value" %} //do this {% when "newvalue" %} //do this instead {% endcase %} 回答1: While you apparently cannot use Liquid conditionals nor Environment Variables (as in

Using JS to find screen height, then apply it to a div class through CSS

南楼画角 提交于 2019-12-07 07:33:44
问题 I'm working on a single-page scroll-to webdesign, and can't get this code to work. What I'm trying to do is get the screen height of the user through JavaScript. Then I want to apply this screen height to my div class, so that I'll always have a container that is the size of the users screen resolution. A liquid design that always fits the screen, so to speak. Here's a short example of where I want the variable screen height to be: <script type="text/javascript"> function matchHeight() { $('

Markdown compiling images with paragraph tags

我怕爱的太早我们不能终老 提交于 2019-12-07 06:38:53
问题 This is just a simple problem but it's one that I can't find on Google to solve this. Basically what is happening is that I have a Jekyll website, and I'm using kramdown for the markdown compiling. When I add an image to a markdown file like below: ![Image Alt Tag](path/to/image) It will compile it with a <p> tag when I don't want it to as seen below. <p><img src="path/to/image" alt="Image Alt Tag" /></p> This is how I would like the markdown file to compile with an image tag <img src="path

Titleize Jekyll category

强颜欢笑 提交于 2019-12-07 02:17:26
问题 I'd like to convert the printed category names of my posts into title case. I couldn't find a Liquid filter that would work. I tried using dashes and the camelcase filter, but no dice. Alternatively, I'd like to print the category name as it's written in the YAML frontmatter. For instance, for a post with: category: Here's the Category When I reference the name: {% for cat in site.categories %} <h1>{{ cat[0] }}</h1> {% endfor %} I see "here's the category" on the page. I would like to see

Jekyll - How can I make avoid a paragraph to be added on a YAML frontmatter markdownify item

江枫思渺然 提交于 2019-12-06 23:23:57
问题 Okay... I have a project where I'm using Jekyll for a podcast project. And I chose to list the hosts in the shownotes by a YAML Front Matter item: hosts: - Name A - Name B - Name C Using this piece of code <li> <strong>Hosts:</strong> <ul> {% for host in page.hosts %} <li>{{ host }} {% endfor %} </ul> I receive the correct list <ul> <li> <strong>Hosts:</strong> <ul> <li>Name A </li> <li>Name B </li> <li>Name C </li> </ul> </ul> However, I want to markdownify this by doing <li> <strong>Hosts:<

Two column Jekyll layout, separated by tags?

房东的猫 提交于 2019-12-06 15:54:46
I'm currently working on a Jekyll blog at the moment, and I'd like to put my markdown files in this format: <div class="row"> <div class="col-md-6"> </div> <div class="col-md-6"> </div> </div> I want my code blocks in one column and everything else (text, headers, etc.) in the other column so that I have side-by-side explanations of my code. Is there any way to do this? It seems Markdown and the Liquid templating engine is very restrictive in this regard. Thanks! You can get desired result by combining Twitter Bootstrap with templating engine: <div class="row"> <div class="col-md-6"> {{