liquid

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

喜欢而已 提交于 2019-12-06 15:52:53
问题 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

Shopify liquid get related blog posts

99封情书 提交于 2019-12-06 13:37:27
In shopify I am using liquid templating to get blog posts which are related to products by their tags, like so: <ul> {% for article in blogs.blog.articles %} {% if article.tags contains product.handle %} <li><a href="{{ article.url }}"><p>{{ article.title }}</p></a></li> {% endif %} {% endfor %} </ul> However, if there are no related posts, I would like to display a message such as "No related posts!" My question is how would I do that? I have contemplated trying to get the articles into an array and testing if it is empty, but I am having difficulty finding out how this is done. Thanks! Try

Jekyll liquid variables as inline CSS values

被刻印的时光 ゝ 提交于 2019-12-06 08:25:33
问题 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

How to access the Rails controller from a liquid tag?

耗尽温柔 提交于 2019-12-06 08:09:47
问题 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

Custom fields for Shopify User Registration Form

对着背影说爱祢 提交于 2019-12-06 06:51:37
问题 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" /

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

穿精又带淫゛_ 提交于 2019-12-06 05:23:17
问题 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.

Sorting Jekyll posts by modification date instead of posted date?

梦想的初衷 提交于 2019-12-06 04:16:37
For someone that updates posts very often it's necessary to have posts sorted from new to old based on last modification date instead of Jekyll's default sort by posted date. There seems to be no easy way of accomplishing this. I've read and tested pretty much all methods out there. Here's what worked (partially as expected): Used this gem https://github.com/gjtorikian/jekyll-last-modified-at but now I have to manually enter last_modified_at in each post's front-matter in order for Jekyll to sort the posts using this loop: {% assign sorted_posts = site.posts | sort: "last_modified_at" |

How to override erb with liquid?

ぐ巨炮叔叔 提交于 2019-12-06 03:36:35
I've added a theming directory to my app as described here , using prepend_view_path . It works as expected. I can now add a view structure in my app under app/themes/my_theme/views Now, I want to be able to override erb templates by dropping in a .liquid file, which will render right off the controller action. For example, I want to override app/views/pages/home.html.erb : <h1><%= t 'it_works' %></h1> ...with app/themes/my_theme/views/pages/home.liquid <h1>It works with {{ "liquid" }}</h1> I don't want to have to specify an array of view paths (upkeep would be awful), but just add .liquid as

Update/Remove cart attributes in Shopify

巧了我就是萌 提交于 2019-12-06 02:57:47
问题 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

How does Jekyll use post.html to generate pages?

非 Y 不嫁゛ 提交于 2019-12-06 00:24:47
I'm having some difficulty getting Jekyll to use a particular theme and I think there's something fundamental I'm missing about how {{ content }} works with posts. So, in a generic Jekyll site, index.html has a layout specified in its front matter. When the site is generated, the layout includes index.html as {{ content }} . It's kind of inverted, where the page specifies the layout and then the layout calls the page, but simple enough. Posts, on the other hand, are all generated via a file, post.html , which resides in the _layouts folder even though it isn't really a layout. Like index.html