Jekyll snippets from building Bicrement
After a few hours work, a static bicrement site is up now :D.
These are some tips and snippets on Jekyll, which I spent some time figured out in the process.
Display previous/next post
You can use page.next
and page.previous
to access the previous and next posts (it does not work for pages).
Display year/month in archive page
If you want to display year
and month
in archive page like
my blog page, here is the code:
Add content menu
On the left sidebar, a sweet content menu of this post is displayed. This is created using JavaScript, take a look at my headings.js script.
Download it, include it with jQuery
, and add a <div id="content-menu"></div>
to
your layout to use it.
Create project pages
This is an annoying part. At first, I create pages for each project.
It turns out that pages cannot be sorted (by filenames’ order, or using sort
liquid markup) on Github Page.
In the end, I have to put them as posts and generate them under /project/
using
permalink
, with a lot more changes in order not to mix project posts with normal posts.
Refer to my site’s source code ;).
Embed iframe elements
Empty tag will cause the page not fully rendered. To embed an iframe element, add some text inside the tag to solve this:
Fork
You can fork my site.
Remove the posts in /_posts/
and get started.
Please keep the credit in the footer, thanks.