liquid

Highlight in html issue with Jekyll/Liquid and pygments

佐手、 提交于 2020-01-24 19:41:10
问题 I'm using Jekyll with pygments and having an issue using {% highlight %} in .html posts. As you can see here, it is just printing out {% highlight %} yet on my homepage the syntax highlighting works See here: iwasasuperhero. Here is the code for the index, and the code for the post: Here I'm not really sure the issue or why it is working on the index but not the post page. Any ideas? 回答1: It seems I have figured out my problem. I was using {{ page.content }} in my post.html instead of just {{

Get Jekyll Configuration Inside Plugin

喜你入骨 提交于 2020-01-22 17:15:07
问题 I'd like to make changes to the Jekyll Only First Paragraph plugin to make the generation of a 'read more ' link a configurable option. To do this I'd need to be able to access the Jekyll site config inside the plugin's AssetFilter . With the configuration available I can make the change. I don't know how to make the site configuration available to the plugin. The code below demonstrates where I'd like site.config available: require 'nokogiri' module Jekyll module AssetFilter def only_first_p

How can I access un-rendered (markdown) content in Jekyll with liquid tags?

血红的双手。 提交于 2020-01-20 04:36:28
问题 From reading the documentation Jekyll's template data one might think that the way to access un-rendered content would be page.content ; but as far as I can tell, this is providing the content of the post as already rendered by the markdown parser. I need a solution that accesses the raw (original markdown) content directly, rather than simply trying to convert the html back to markdown. Background on use case My use case is the following: I use the pandoc plugin to render markdown for my

Jekyll – Check if page belongs to a collection

拈花ヽ惹草 提交于 2020-01-15 10:16:10
问题 Is there a way to check if a current page belongs to a collection? If so, can I check what’s the label of the collection? Background story: What I’m trying to achieve is to display a different layout for all pages that belong to a collection. With this new layout I want to display a side navigation (some sort of „See also”) with listing of all pages in the collection that the current site belongs to. In case my question turns out to be dumb – forgive me, I’m new to jekyll and I really tried

Jekyll – Check if page belongs to a collection

风格不统一 提交于 2020-01-15 10:15:01
问题 Is there a way to check if a current page belongs to a collection? If so, can I check what’s the label of the collection? Background story: What I’m trying to achieve is to display a different layout for all pages that belong to a collection. With this new layout I want to display a side navigation (some sort of „See also”) with listing of all pages in the collection that the current site belongs to. In case my question turns out to be dumb – forgive me, I’m new to jekyll and I really tried

Add properties to a page from a Jekyll plugin

前提是你 提交于 2020-01-14 10:36:22
问题 Say I want to have a page with content like this: <h1>{{page.comment_count}} Comment(s)</h1> {% for c in page.comment_list %} <div> <strong>{{c.title}}</strong><br/> {{c.content}} </div> {% endfor %} There are no variables on the page named comment_count or comment_list by default; instead I want these variables to be added to the page from a Jekyll plugin. Where is a safe place I can populate those fields from without interfering with Jekyll's existing code? Or is there a better way of

“no implicit conversion of Integer into String” error with Jekyll posts that have numbered titles

微笑、不失礼 提交于 2020-01-13 08:35:10
问题 I have a Jekyll blog hosted on GitHub Pages that I recently updated to HTTPS. In doing so, I discovered that recent updates to Jekyll were causing my blog to no longer build properly. Running a local install I kept encountering the following error: Liquid Exception: no implicit conversion of Integer into String in /_layouts/default.html After some trial and error I was able to identify the following posts as causing the problem: 2003-09-21-100.md 2004-02-10-10000.md 2004-02-28-228.md 2004-09

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

喜夏-厌秋 提交于 2020-01-11 09:35:29
问题 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

using Liquid variables inside of a liquid tag call

给你一囗甜甜゛ 提交于 2020-01-09 05:22:28
问题 I made a custom link tag in Liquid and I am trying to be able to pass liquid variables into the call for that tag like so {{ assign id = 'something' }} // this value is actual dynamic while looping through data {% link_to article: id, text: 'Click Me!' %} // my custom tag However this results in the article parameter being passed in as 'id' instead of 'something' as per the assign statement above it. Does anyone know how to pass variables into tag calls? 回答1: I've recently solved this very

How to pass Javascript api request result variables to shopify liquid variable

▼魔方 西西 提交于 2020-01-06 07:45:28
问题 I have a javascript that makes a api call and gets a json response. I need to pass this to my liquid template and iterate over it. How do i pass the result variable on get request to a shopify liquid variable.? Thanks..! 回答1: You cannot do that. Liquid is rendered Server Side... whereas your Javascript is considered to be client side coding. When you are rendering your Liquid, you can transfer Liquid into Javascript for use later, but not vice versa. Also, if you are getting JSON via an API