liquid

Jekyll: Using values from _config.yml in SCSS

烈酒焚心 提交于 2019-12-24 15:35:53
问题 In my Jekyll project, I have the following in my _config.yml file: colors: - name: red hex: '#FF0000' - name: yellow hex: '#FFFF00' - name: blue hex: '#0000FF' In assets/css/colors.scss , I want to create classes for the colors as follows: {% for color in site.colors %} .{{ color.name }} { color: {{ color.hex }}; } {% endfor %} When I do so, I get the following error: Error in _assets/css/background-test.scss:6 Invalid CSS after "}": expected selector or at-rule, was "{% for color in..."

Creating a custom block tag in liquid

走远了吗. 提交于 2019-12-24 14:57:00
问题 I'm trying to make a custom tag {% render-slider, ['image1.jpg', 'image2.jpg',...] %} that renders in to the following html code. <div class="slider"> <a href="#" class="unslider-arrow prev icon-chevron-with-circle-left"></a> <a href="#" class="unslider-arrow next icon-chevron-with-circle-right"></a> <ul> <% images.each do |image| %> <li style="background-image: url(<%= asset_path image %>);"> <% end %> </li> </ul> </div> This will feature be used on a blog website, so that users can use this

In Jekyll, how to show “posts from last week”

荒凉一梦 提交于 2019-12-24 09:53:29
问题 I'm not sure to get the liquid syntax to help me pull posts that were published during the same week as the build date. Is that possible? There are simpler ways to get a list of recent posts, but this approach would be useful for my project. I've tried several things I found by searching but no joy yet. 回答1: The above solution works, but doesn't span years. So I utilized the concepts and came up with a simpler and more flexible solution for filtering for a timeframe (which can be any variable

Shopify liquid : cart-template variant is not defined

自作多情 提交于 2019-12-24 08:58:31
问题 I am simply allowing to checkout out of stock product to buy. When a customer wants to buy product has inventory less than zero and clicks on view cart from ajax cart, I simply want to show message " dispatch by 7 June." in cart-template.liquid .I have applied logic as given below. If required full code ready to share. {% if variant.inventory_quantity < 1%} <p id="dispatch" style="color: #f48c21">Will be dispatched by June 7</p> {{variant.inventory_quantity}} {% endif %} <script>console.log

Everything between anchor tag render's raw html tags in Jekyll/Liquid

拥有回忆 提交于 2019-12-24 07:50:03
问题 I'm trying to build an include in Jekyll that has multiple variables, but the basic idea is that I'm wrapping multiple pieces of content in an anchor tag like the following: <a href="#> <h2>{{ include.piece-title }}</h2> <h3>{{ include.piece-date }}</h3> <img src="{{ include.piece-url }}" alt="{{ include.image-description }}"> <p>{{ include.piece-description }}</p> </a> However, this renders to the raw html (although the image works). If I instead wrap it in a <figure> tag instead of the <a>

Using liquid in Rails 3

女生的网名这么多〃 提交于 2019-12-24 05:30:46
问题 Im making a Rails blog engine for learning purpose. I want to use liquid as template engine. I have something like this ## posts_controller.rb ... def index @posts = Post.all end ... ## posts/index.html.liquid {% for post in posts do %} {{ post.title }} {% endfor %} That gave me the following error: undefined local variable or method `template' for #<PostsController:0x103d16290> I already had LiquidView loaded in initializers/liquid.rb Please let me know what is my problem. Thank you 回答1: As

jekyll long pagination, how to shorten it?

狂风中的少年 提交于 2019-12-24 04:25:06
问题 How can I solve the following problem, for example if I have many pages, my pagination looks like this: < 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 > Is it possible to shorten this like normal pagination, < 1, 2, 3, 4, 5, 6, 7 ... 22, 23, 24, 25, 26 > I mean, strip the pages, and if we are in the middle, like this: < 7, 8, 9, 10 ... 22,23, 24, 25, 26 > 来源: https://stackoverflow.com/questions/27963027/jekyll-long-pagination-how-to-shorten-it

Pulling from specific subfolders using {% for post in site.posts %}

我们两清 提交于 2019-12-24 01:18:43
问题 I'm currently working on my first Jekyll site. I have a page in which 2 seperate sections display previews of certain posts (a styled thumbnail). What I want is for these sections to display posts from different subfolders in _site/_posts. I have organized _posts to contain two subfolders, /lesplannen and /verslagen (lesson plans and reports), each containing a bunch of articles. My code for one of these sections is as follows (Jade formatting): {% for post in site.posts limit: 4 %} a(href="{

How to remove unnecessary indent and break line in highlight jekyll

混江龙づ霸主 提交于 2019-12-23 23:04:46
问题 I use jekyll code highlight with gem rouge . Templates - Jekyll • Simple, blog-aware, static sites Code (index.html) --- layout: default --- <div class="container-fluid"> <div class="row"> <div class="col-sm-2" style="background-color:red;"> {% highlight ruby %} def hoge puts 'red' end {% endhighlight %} </div> <div class="col-sm-8" style="background-color:blue;"> {% highlight ruby %} def foo puts 'blue' end {% endhighlight %} </div> <div class="col-sm-2" style="background-color:yellow;"> {%

Using liquid tempting in CSS on Jekyll to adjust background color of divs on a per page basis

别来无恙 提交于 2019-12-23 19:53:03
问题 I'm using Jekyll and Liquid for my website. I've been completely stuck on using liquid in the CSS to compile correctly. I'm trying to use different colors for the borders of each page, and have the default set to black. I appreciate any insight y'all may have. #splash {width: 100%; height: 10%;} #splash background-color: {% if page.accent %}{{ page.accent }}{% else %}{{ black }}{% endif %} <div id= "splash"> </div> 回答1: You need to 2 rows of --- at the top of your file for it to compile