liquid

Can't seem to get Jekyll to see posts that are in subdirectories from the root folder

若如初见. 提交于 2019-12-04 20:48:39
I have used collections in my Jekyll website for GitHub Pages. I'm trying to get Jekyll to see the Markdown files inside the collection folder, _projects . Here's a rundown of the file structure: root │ ├─ _projects │ │ │ ├─ project_1.md │ └─ project_2.md │ └─ /*Rest of the Jekyll folders and files, _posts, _includes, etc.*/ At the moment, I realized that you must put the Markdown files in the root, so Jekyll can be able to see and parse the files to display them when after you clicked a link that points to them via permalinks. But it cannot "see" the Markdown files if the files are not in the

Rails Form block in helper - How do i include “Protect from forgery”

≡放荡痞女 提交于 2019-12-04 14:54:34
I'm trying to build a form block for my liquid theme language. I have based my approach on this answer . How ever the answer seems to be incomplete. The problem is that protect from forgery and some other methods are unavailable. Causing an error: Liquid error: undefined method `protect_against_forgery?' for # This is my code: class LiquidFormTag < Liquid::Block include ActionView::Context include ActionView::Helpers::FormHelper def initialize(tag_name, markup, tokens) super end def render(context) form_tag("#") do super end end end Liquid::Template.register_tag('liquid_form', LiquidFormTag)

How to access the Rails controller from a liquid tag?

冷暖自知 提交于 2019-12-04 14:08:26
I want to be able to render Rails' CSRF stuff on a liquid template. I found two pages that give me some clues: http://robots.thoughtbot.com/post/159806314/custom-tags-in-liquid https://github.com/locomotivecms/engine/blob/v2.0.0.rc12/lib/locomotive/liquid/tags/csrf.rb My problem is that the thoughtbot link does not explain how to get register the controller in the first place. Then, looking at the locomotivecms source, I can see that the template is registered with a new context , but this is done in the helper. I don't think this approach would be appropriate for me because I want to be able

Jekyll liquid variables as inline CSS values

折月煮酒 提交于 2019-12-04 14:06:10
Is passing liquid variables as inline styles commonly frowned upon? Here is an example of my markup: <div class="span-8-12"> <h6> {{page.role}}</h6> <h1 style="color:{{ page.accentColor }};"> {{page.title}} </h1> </div> <article class="intro"> <p style="color:{{ page.txtColor }};"> {{ page.summary }} </p> </article> I am setting h1 and p colors using the liquid variables in my posts. I know I could pass the variable directly to a CSS file, but then'd i'd have to write even more markup and CSS. Is this method valid or is there a better method on systematically changing values of color based off

Custom fields for Shopify User Registration Form

扶醉桌前 提交于 2019-12-04 13:48:02
I can't find any documentation on how to add custom fields for the user registration forum so I tried something but didn't work: <div class="single-full-width customer"> <div class="login"> {% form 'create_customer' %} {% if form.errors %} {% for field in form.errors %} <p class="input-error-wrapper"><span>{{field}} {{ form.errors.messages[field] }}</span></p> {% endfor %} {% endif %} <p> <label>First Name:</label> <input type="text" value="" name="customer[first_name]" class="input-text-1" /> </p> <p> <label>Last Name:</label> <input type="text" value="" name="customer[last_name]" class=

Is it possible to generate a table of contents using kramdown in a page other than a post? If so, how?

百般思念 提交于 2019-12-04 11:19:37
The index page on my Jekyll site is meant to be exactly like a post with only one extra bit of code for navigating the other posts. I'm not really using it to generate a blog per se, but a bunch of press pages. Now within each post I am using kramdown to generate a table of contents like so: * This line is a placeholder to generate the table of contents {:toc} That works fine for all the posts, but when I try to use it on anything but a post, it doesn't generate. The output is simply empty. It doesn't show the raw kramdown above or anything, it just disappears and nothing (especially not a TOC

Jekyll blog posts on non index.html pages

为君一笑 提交于 2019-12-04 11:19:14
问题 I have used the below code snippet from the Jekyll website to paginate Jekyll plog posts on my index.html page: <div class="container"> <ul class="post-list"> <!-- This loops through the paginated posts --> {% for post in paginator.posts %} <h1><a href="{{ post.url }}">{{ post.title }}</a></h1> <p class="author"> <span class="date">{{ post.date }}</span> </p> <div class="content"> {{ post.content }} </div> {% endfor %} {% if paginator.total_pages > 1 %} <div class="pagination"> {% if

How can you render a template within a layout using Liquid template language?

风格不统一 提交于 2019-12-04 10:59:31
问题 I'm trying to render a liquid template within a liquid layout (Liquid Template lang, not CSS liquid layout stuff). I can't seem to get the layout part to render. Currently using: assigns = {'page_name' => 'test'} @layout = Liquid::Template.parse(File.new(@theme.layout.path).read) @template = Liquid::Template.parse(File.new(self.template.path).read) @rend_temp = @template.render(assigns) @rend_layout = @layout.render({'content_for_layout' => @rend_temp}) render :text => @rend_layout, :content

Comparing dates in liquid

被刻印的时光 ゝ 提交于 2019-12-04 10:40:24
问题 I'm using Liquid with Jekyll to post dates on my band's website (http://longislandsound.com.au) What I want is to automatically hide old dates, so I don't have to go in and delete them again. I think the best way to do it would be to compare the post date to the current date and only display the post if the date is in the future, but I can't figure out how to do this. Here is the current code: <ul id="dates"> {% for post in site.posts reversed %} <a href="{{post.link}}"> <li> <div class="date

Update/Remove cart attributes in Shopify

只谈情不闲聊 提交于 2019-12-04 08:23:36
I am using cart attributes to add extra information for each product to the cart (from the product page). I am specifically using cart attributes over line item properties because the client needs to be able to edit this information in the order later on which line item properties don't allow . Adding the information works just fine, the problem comes in when a customer decides to remove an item from the cart because although the item is removed, the cart attribute remains since it is not specifically tied to the product (other than a naming convention that we give it.) So, is there a way to