Jekyll

How to render all Jekyll pages with a different layout?

寵の児 提交于 2019-12-22 13:07:43
问题 I'm trying to create a Jekyll plugin, which should go through all posts and render them with a different layout. Can't figure out how to do that. That's what I have so far: module Jekyll class MyGenerator < Generator priority :low def generate(site) site.posts.docs.each do |doc| page = Page.new(site, site.source, File.dirname(doc.relative_path), doc.basename) page.do_layout( site.site_payload, 'post' => Layout.new(site, site.source, '_layouts/my.html') ) page.write(?) site.pages << page end

How does Jekyll use post.html to generate pages?

馋奶兔 提交于 2019-12-22 10:47:05
问题 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,

How to link post categories in Jekyll

我的梦境 提交于 2019-12-22 09:57:29
问题 I've got the following code in my index.html for Jekyll. I'm trying to find a way to link the categories associated with each post to the actual post themselves. So, if a post contains the category "travel" I want to click on a link that says "travel" which will bring me to all posts categorized as such. <ul class="post-list" style="list-style-type: none;"> {% for post in paginator.posts %} {% unless post.categories contains 'portfolio' %} <li> <h3><a href="{{ post.url }}">{{ post.title }}</a

Jekyll YAML cyclic reference

蓝咒 提交于 2019-12-22 09:47:09
问题 I have a jekyll project with two pages, each backed by YAML maps that both reference each other. For example: a: &a name: "Ay" parents: [] children: [*b] b: &b name: "Bee" parents: [*a] children: [] Vanilla YAML seems not to support using an alias/anchor before its been defined, which invalidates this strategy. Is there any way, perhaps using liquid-fu that would let me generate pages that enumerate an entry's parents and children? 回答1: You just need to give the value on first occurrence: a:

Table of Contents in Markdown, using only the standard / out of the box Github Pages tooling?

纵然是瞬间 提交于 2019-12-22 09:21:43
问题 Trying to setup up a blog / documentation using purely hosted / "out of the box" GitHub Pages Jekyll; I am specifically trying to avoid having to run Jekyll locally (although I can). I have tried http://www.seanbuscay.com/blog/jekyll-toc-markdown/ but that doesn't work. Is this possible, or does it truly require additional tooling? 回答1: By default Jekyll uses Kramdown, it already comes with a TOC generator. You don't need a plugin for this so it will work with github-pages. kramdown supports

using jQuery with Jekyll site hosted on Github pages

淺唱寂寞╮ 提交于 2019-12-22 08:29:51
问题 I have a simpled Jekyll blog hosted on github pages and I have included jQuery and a tablesorter plugin but come across error and to all my knowledge this error is caused by not having jQuery loaded in the correct order. my image below shows the code is in the right order.. so my question is simply is it being stopped by Github itself somehow? and if so how? edit: for completion/clarity here is the exact code: <script type="text/javscript" src="/js/jquery.min.js" ></script> <script type="text

using jQuery with Jekyll site hosted on Github pages

梦想与她 提交于 2019-12-22 08:29:22
问题 I have a simpled Jekyll blog hosted on github pages and I have included jQuery and a tablesorter plugin but come across error and to all my knowledge this error is caused by not having jQuery loaded in the correct order. my image below shows the code is in the right order.. so my question is simply is it being stopped by Github itself somehow? and if so how? edit: for completion/clarity here is the exact code: <script type="text/javscript" src="/js/jquery.min.js" ></script> <script type="text

Jekyll, Liquid - Get all pages from category from page

被刻印的时光 ゝ 提交于 2019-12-22 07:20:11
问题 I have a question in Jekyll Liquid. I have layout, where I want to show pages from category. To show category I use page.categories variable. When I show in bracket {{page.categories}} is correct. but I don't know, how to pass to loop? {% for post in site.categories[page.categories] %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} {% for post in site.categories[{{page.categories}}] %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} Don't work. If I

Trouble Linking External JavaScript with Jekyll

不羁的心 提交于 2019-12-22 05:43:12
问题 I have a site hosted by GitHub that uses Jekyll, and I've been (successfully) using an internally defined script in each layout that will generate a random tagline from an array of them. I'm trying to move this script to an external tagline.js , but so far I've been unsuccessful. Here's the basic tagline generating script, in case there's something in the code causing this (which I doubt, honestly, due to its simplicity; but it's always a possibility): var tags = [ 'tag1', 'tag2', 'tag3' ];

Support for adding lazy load for images in Markdown

自作多情 提交于 2019-12-21 16:52:50
问题 I'm using kramdown parser to convert markdown to html. I want to use lazy load for images without modifying original markdown syntax. I can achieve this by editing link.rb file in kramdown gems. But I don't want to follow this way. Because if anyone updating kramdown I'll lose these edits. Is there anyother way to do this without modifying original image syntax? Original Image Syntax: ![](some image link) Current Output (without above edit): <img src="some image link" alt=""/> Expected Output