Jekyll

Jekyll - declare image path in front matter as variable using {{ site.url }}

房东的猫 提交于 2019-12-21 04:23:05
问题 When I use the {{ site.url }} tag for an image path inside a variable in the front matter, it doesn't get translated into HTML. The following works perfectly: --- layout: post title: chickpea img: <img class="caption__media" data-interchange="[../asset/img/chickpea-small.jpg (small)], [../asset/img/chickpea-medium.jpg, (medium)], [../asset/img/chickpea-large.jpg, (large)]"> --- This does NOT work: --- layout: post title: chickpea img: <img class="caption__media" data-interchange="[{{site.url}

Table of contents using Jekyll and Kramdown

房东的猫 提交于 2019-12-21 03:43:25
问题 I'm trying to use Kramdown's auto "Table of Contents" generator on a page (not a post) on my Jekyll site. _includes/toc.html <nav> <h4>Table of Contents</h4> {:toc} </nav> my_cool_stuff/my_cool_page.md --- layout: page --- {% include toc.html %} # The title of my page ## The Subtitle of my page The HTML is generated literally and I'm not getting a list of headers. <nav> <h4 class="toc_title">On This Page</h4> {:toc} </nav> What am I setting up wrong? 回答1: {:toc} is kramdown tag for automatic

How do I use markdownify in Jekyll to show an excerpt on the index

点点圈 提交于 2019-12-21 03:27:21
问题 I'm looking to show a short excerpt of text from a longer post or page on the index page. I was going to use a custom variable in the Front Matter and grab that, but then I saw the filter for .excerpt I see in the Jekyll docs there's something called {{ page.excerpt | markdownify }} How would I markup the markdown on a page or post in order to use that filter? edit: Or does markdownify take the entire .md document? 回答1: In the post markdown files you need to first set your excerpt, here is an

Jekyll templates using django-like liquid blocks / inheritance

百般思念 提交于 2019-12-20 19:36:55
问题 I'm getting into Jekyll in a big way and would like to use it as a general front-end development platform, but am running up against the limitations of the Liquid templating language, specifically its difference to Django templating. I discovered the liquid-inheritance gem, which adds the all-important Extends and Block syntax from Django. This blog post extends the gem further to suit Jekyll's file system: http://www.sameratiani.com/2011/10/22/get-jekyll-working-with-liquid-inheritance.html

Is there a markdown parser supported on Jekyll that plays nicely with mathjax?

本秂侑毒 提交于 2019-12-20 18:29:12
问题 I use a Jekyll based blog and need a markdown parser that won't clobber my Mathjax expressions (for instance, interpreting b_t - b_{t-1} as b<em>t - b</em> t - 1 ). Mathjax and markdown get along nicely over on math.stackechange.com and mathoverflow.net. Some parsers also need to double escape the begin/end equation symbols \\( , while it seems others do not. Things that aren't quite solutions: Redcarpet2 has an option for no_intra_emphasis , which avoids underscores between letters being

Jekyll Filename Without Date

99封情书 提交于 2019-12-20 17:38:40
问题 I want to build documentation site using Jekyll and GitHub Pages. The problem is Jekyll only accept a filename under _posts with exact pattern like YYYY-MM-DD-your-title-is-here.md . How can I post a page in Jekyll without this filename pattern? Something like: awesome-title.md yet-another-title.md etc.md Thanks for your advance. 回答1: Don't use posts; posts are things with dates. Sounds like you probably want to use collections instead; you get all the power of Posts; but without the pesky

How do I protect a directory within github-pages?

余生长醉 提交于 2019-12-20 11:34:52
问题 I am building my personal website using Jekyll and hosting it at github-pages. I would like to have a password protected area (just password protected directory, not the whole website). I have tried a few options and tricks to get htaccess to work but failed. I would like to know if someone managed to use htaccess , or any other method, to protect a directory on github-pages. Listing solutions which did not work for me (or I failed to get them to work): *Flohei. *Jeremy Ricketts. 回答1:

Indenting generated markup in Jekyll/Ruby

一世执手 提交于 2019-12-20 10:47:08
问题 Well this is probably kind of a silly question but I'm wondering if there's any way to have the generated markup in Jekyll to preserve the indentation of the Liquid-tag. World doesn't end if it isn't solvable. I'm just curious since I like my code to look tidy, even if compiled. :) For example I have these two: base.html: <body> <div id="page"> {{content}} </div> </body> index.md: --- layout: base --- <div id="recent_articles"> {% for post in site.posts %} <div class="article_puff"> <img src=

Get next and previous elements out of an array in liquid

血红的双手。 提交于 2019-12-20 10:43:51
问题 Short version: I want to add 1 to a number in a liquid template and use the result as an array index. {% capture plus_one %}{{ 0 | plus: 1 }}{% endcapture %} <div>-Value of plus_one: {{plus_one}}</div> <div>-This works: {{site.posts[1].title}}</div> <div>-This doesn't: {{site.posts[plus_one].title}}</div> Result: -Value of plus_one: 1 -This works: The Zone -This doesn't: Long version: I'm using Jekyll, with no plugins. I want to give the current post a link to the next post that is in the

Jekyll serve didn't work: It looks like you don't have pygments or one of its dependencies installed

寵の児 提交于 2019-12-20 09:47:10
问题 Configuration file: /Users/andrechristoga/Documents/type-theme/_config.yml Deprecation: You appear to have pagination turned on, but you haven't included the `jekyll-paginate` gem. Ensure you have `gems: [jekyll-paginate]` in your configuration file. Source: /Users/andrechristoga/Documents/type-theme Destination: /Users/andrechristoga/Documents/type-theme/_site Incremental build: disabled. Enable with --incremental Generating... Dependency Error: Yikes! It looks like you don't have pygments