liquid

Is there a way to check whether a jekyll site is being served locally?

你说的曾经没有我的故事 提交于 2019-11-30 17:25:33
问题 I'd like to add the following line to my head.html solely when running jekyll serve locally: <script src="http://127.0.0.1:35729/livereload.js?snipver=1"></script> I'm thinking of using some simple liquid check if possible. 回答1: Alternative solution (for example, if you're hosting your Jekyll site on your own server and not on GitHub Pages) : You can set a value in the config file _config.yml like this: environment: prod Then, you can have another config file which overrides the same value, I

How do a loop n.times in Liquid templating using an existing for loop

风流意气都作罢 提交于 2019-11-30 14:01:04
In ruby I can do n.times do, is it possible to do this in Liquid markup? My current loop is: for video in site.posts my goal is to run this loop 2 times. There are currently 4 objects that will be called through the loop but I want 8. I hope this is clear! Justin Niessner You should be able to use a for loop with a range ( n is the number of iterations): {% for num in (1..n) %} In some instances of Shopify Liquid, it may also work to use {% for num in (1...n) %} If like me you want to have a dynamic number that is not based upon a collection length or in-build var you can use includes and

Hierarchical Categories in GitHub Pages

ぃ、小莉子 提交于 2019-11-30 11:37:43
I'm using Jekyll on GitHub pages, and I want to have hierarchical categories like this: animals -> mammals -> cats -> _posts -> housecat.md, tiger.md animals -> mammals -> dogs -> _posts -> poodle.md, doberman.md animals -> reptiles -> lizards -> _posts -> iguana.md, chameleon.md I'd like users to be able to visit /animals and see a listing of every post from every category. But if they go to /animals/mammals , they'd only see mammals. If they go to /animals/mammals/cats , then they only see cats. I know I can do this manually by putting an index.html file in every single directory and then

Date Math / Manipulation in Liquid Template Filter

限于喜欢 提交于 2019-11-30 08:22:16
I'm constructing an "Integration URL" in Desk.com, which uses the Shopify Liquid Template filter syntax. This URL needs to contain a "start date" and an "end date" for a query where the start date is 7 days ago and the end date is right now. To achieve this I think I need to subtract 7 days (604800 in Epoch time) from the 'now' object and then apply my formatting but I can't figure out valid syntax for that. For the current time, this syntax is valid and working: {{'now' | date: "%b %d, %Y %I:%M %p -0500" | uri_encode | replace:"+","%20"}} For 7 days ago, here's the best I could come up with

How to get Markdown processed content in Jekyll tag plugin

眉间皱痕 提交于 2019-11-30 07:29:54
I'm working on a Jekyll tag plugin for my Octopress site to help me make a 'note' element. I just want to be able to highlight a piece of information on my blog as a side note, like this. The problem is, I can't figure out how to get the contents of this tag to be processed (i.e. Markdown or Textile). The above image is only achieved is I actually make my links with html code. Here is how it ends up turning out when I use markdown in the contents. In my post, I'm writing the contents of this like so. {% note %} This is the third post in my Start to Finish series. Last time I talked about [Git]

Jekyll, Liquid, Random numbers

人走茶凉 提交于 2019-11-30 06:57:24
I would like to have a set of links <li> <h2>Random Articles</h2> <ul> <li><a href="#">Old article 1</a></li> <li><a href="#">Old article 1</a></li> <li><a href="#">Old article 1</a></li> </ul> </li> But I want to generate the links from a random selection of my posts. I'm using jekyll and liquid to generate the site. I must use built in parts of jekyll as I'm hosting on github. I'm not really sure where to start on this. Google searches on the topic are fruitless. I had a similar desire and got down to defining a custom Liquid tag (see http://github.com/mojombo/jekyll/wiki/Plugins ) which

How to list files in a directory with Liquid?

假如想象 提交于 2019-11-30 02:58:28
I'm trying to learn how to use Jekyll along with Bootstrap; while studying them, I decided that I'd like to have an image carousel on my homepage. Since I'm really lazy I don't want to hard-code the paths needed to display every image inside the layout, and I wouldn't either prefer to use an array to store the list of images. I was wondering if there's any tag that could ask Jekyll to do these two steps: Look inside a specific directory For each file you found in that directory, repeat a block of code Basically what I'd like to write is something that vaguely resemble this piece of (imaginary)

Enabling Liquid templating syntax highlight in webStorm/phpStorm

≡放荡痞女 提交于 2019-11-29 21:03:36
I wonder if someone managed to enable the Liquid templating engine syntax highlighting in WebStorm IDE , I work a lot on Shopify stores and really like using Webstorm for that purpose. Did anyone managed to get this working? I found some resources regarding this issue on JetBrain's forum though it didn't quite got me anywhere, there is one dude who suggested using ' tmBundle ' and that might work if you do some dark magic. The thread is: RUBY-7210 and the official plugin request: JetBrain's plugins: Liquid Templating language request Ilia luk I've found out that Twig have a very similar syntax

How to group data by first letter and order it alphabetically from a .csv file in liquid?

a 夏天 提交于 2019-11-29 16:22:11
I have managed to order all the data alphabetically but what I can't do is group it by first letter and also display the first letter like below: A apple arrow B band blur and so on... Here is my code for displaying the ordered data. --- layout: default --- {% capture thelistings %} {% for listing in site.data.terminology %} <li>{{ listing.term }}: {{ listing.definition }}</li> {% endfor %} {% endcapture %} {% assign allsortedlistings = thelistings | split:" " | sort %} <ul> {% for allterms in allsortedlistings %} {{ allterms }} {% endfor %} </ul> This outputs: again: now it is here aunt:

List Subcategories in GitHub Pages

喜你入骨 提交于 2019-11-29 10:36:06
Edit: I've created a repository here that tests jibe's answer below. I just end up getting a blank page when I visit /animals , so any help is appreciated! This is a follow-up to this question: Hierarchical Categories in GitHub Pages In that question, I found out how to list the posts of a particular hierarchical category. Now I'm trying to figure out how to list the subcategories of a particular hierarchical category. I'm using Jekyll on GitHub pages, and I want to have hierarchical categories like this: animals -> mammals -> cats -> _posts -> housecat.md, tiger.md animals -> mammals -> dogs