liquid

Get today's date in Jekyll with Liquid markup

不想你离开。 提交于 2019-12-03 02:54:25
问题 This (should) be easy, I think, but I'm unable to get today's date to show in a Jekyll page using Liquid markup. According to the documentation, I should be able to do this to get this date's year: {{ 'now' | date: "%Y" }} But all that gets rendered is the string now , not any formatted date. What am I doing wrong? 回答1: It didn't work for me either. It appears you've hit a current bug in the Ruby 1.9.3 support. There is a pull request that fixes the bug, but it's not incorporated yet. A

Liquid State Machine: How it works and how to use it?

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am now learning about LSM (Liquid State Machines), and I try to understand how they are used for learning. I am pretty confused from what I read over the web. I'll write what I understood -> It may be incorrect and I'll be glad if you can correct me and explain what is true: LSMs are not trained at all: They are just initialized with many "temporal neurons" (e.g. Leaky Integrate & Fire neurons), while their thresholds are selected randomly, and so the connections between them (i.e. not each neuron has to have a common edge with each of the

Does Liquid have a does not contain or not in array operator?

二次信任 提交于 2019-12-03 01:02:36
When calling items from and array in a Liquid template, how do you call does not contain or not in array ? unless to the rescue ! Create an [A, B, C] array. {% assign input = "A,B,C" | split:"," %} unless print only if constrain is not met. This prints nothing: {% unless input contains 'A' %}No A{% endunless %} This prints " No Z ": {% unless input contains 'Z' %}No Z{% endunless %} 来源: https://stackoverflow.com/questions/30822160/does-liquid-have-a-does-not-contain-or-not-in-array-operator

Get next and previous elements out of an array in liquid

♀尐吖头ヾ 提交于 2019-12-03 00:07:18
Short version: I want to add 1 to a number in a liquid template and use the result as an array index. {% capture plus_one %}{{ 0 | plus: 1 }}{% endcapture %} <div>-Value of plus_one: {{plus_one}}</div> <div>-This works: {{site.posts[1].title}}</div> <div>-This doesn't: {{site.posts[plus_one].title}}</div> Result: -Value of plus_one: 1 -This works: The Zone -This doesn't: Long version: I'm using Jekyll, with no plugins. I want to give the current post a link to the next post that is in the same category. (The category is hardcoded to 'journal' in this code.) My code loops over all posts in the

Indenting generated markup in Jekyll/Ruby

邮差的信 提交于 2019-12-02 23:21:05
Well this is probably kind of a silly question but I'm wondering if there's any way to have the generated markup in Jekyll to preserve the indentation of the Liquid-tag. World doesn't end if it isn't solvable. I'm just curious since I like my code to look tidy, even if compiled. :) For example I have these two: base.html: <body> <div id="page"> {{content}} </div> </body> index.md: --- layout: base --- <div id="recent_articles"> {% for post in site.posts %} <div class="article_puff"> <img src="/resources/images/fancyi.jpg" alt="" /> <h2><a href="{{post.url}}">{{post.title}}</a></h2> <p>{{post

How do you comment out in Liquid?

北城以北 提交于 2019-12-02 23:19:06
What is the correct way to comment out in the Liquid templating language? In Liquid you comment out using the {% comment %} and {% endcomment %} tags: {% comment %} This is a comment in Liquid {% endcomment %} It doesn't matter if the comment is inline or a block comment. {% comment %} This is a block comment in Liquid {% endcomment %} okconfused Liquid allows you to leave un-rendered code inside a Liquid template by using the {% comment %} and {% endcomment %} tags. Input: Anything you put between {% comment %} and {% endcomment %} tags is turned into a comment. Output: Anything you put

Using liquid to sort posts alphabetically

孤街醉人 提交于 2019-12-02 20:25:59
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 %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} It works, but the posts are jumbled up. Would look much nicer if they were sorted alphabetically I think. Thanks Christian Specht It can be done without a plugin, which means that it works with Github Pages . You have to use some ugly string manipulation tricks, though. I used a similar approach to implement a tag page (that lists all posts for each tag) . Same approach, slightly

Jekyll & Liquid: Output category list with post count?

我只是一个虾纸丫 提交于 2019-12-02 18:25:23
I'm somehow stuck and don't find the right way to do it. I want to output a category list with the number of posts in each categorie. I got this far: https://paste.xinu.at/dOLtod/ but I never managed to get the real count. I tried so many ways and nothing worked, for example going through each post and checked on every category if it equals {{ category | first }}. Here is the code without the count: <ul class="dropdown-menu"> {% for category in site.categories %} <li class="camelize_me"> <a href="/tags/{{category | first}}/"> {{category | first }} <span class="badge"> <!-- Post count here -->

Get today's date in Jekyll with Liquid markup

随声附和 提交于 2019-12-02 16:28:35
This (should) be easy, I think, but I'm unable to get today's date to show in a Jekyll page using Liquid markup. According to the documentation , I should be able to do this to get this date's year: {{ 'now' | date: "%Y" }} But all that gets rendered is the string now , not any formatted date. What am I doing wrong? It didn't work for me either. It appears you've hit a current bug in the Ruby 1.9.3 support. There is a pull request that fixes the bug, but it's not incorporated yet. A workaround is listed, perhaps it will work for you: {{ site.time | date: '%y' }} To get the whole year, for

Passing parameters to inclusion in Liquid templates

↘锁芯ラ 提交于 2019-12-02 15:23:51
On my Jekyll-powered website I have an inclusion that does something function-like, but I can't figure out how to pass it parameters correctly. When I use {% include ... %} , passing parameters like this.. {% include function.liquid foo="{{ baz.quux }}" %} ..it just passes the literal string {{ baz.quux }} which is, of course, not what I wanted! I want to pass the value of baz.quux . How do I do this? Thanks! David Hutchison There are two ways to achieve this. I have tested both approaches against the github-pages version of Jekyll. Using Capture Assuming you are referencing {{ foo }} in the