This note is used for you who have already had the basic idea about jekyll and how to create a jekyll site. This note is only for quickly reference.
- Rouge CSS file theme (Pygment)
- Official dependencies / gems supported by Github Pages.
Read this readme. An example is an old version of this site.
This tut is for macOS 11.0 Big Sur.
Follow WSL on Windows using WSL2 on Windows.
- Disable
jekyll-feed
- Run
bundle exec jekyll serve -I(wuthI) to generate the changed file only. If you create a new file, open a new terminal tab and runbundle exec jekyll build.
- Upgrade to Jekyll 4.0.
- Add
gem "liquid-c"toGemfileand makebundle update
- Use
jekyll-include-cache(both inGemfileand_config.yml)
Read more in this article.
- Comment line
jekyll-feedinGemfile
- Comment line
jekyll-feedin_config.yml
- Rebuild.
If in sitemap, there is error like
<loc>/reading</loc>, check your _config.yml + make sure there is an url inside url field.Warning
If you using
baseurlList all posts in each category,
List all posts in ABC order (ref)
List of categories and tags in a single line with commas,
Read this source code.
You can use directly by
of only once,
Or even shorter,
- Local gems:
gem list jekyll.
- Current jekyll version of website: check
Gemfile. Need to runbundle updateif change any version in this file.
Edit this post on github (put below link in your post layout),
There are several choices for you to choose, it depends on your need.
- Suppose your github account is
<username>.
- Create a repo
<username>.github.io.
- Put your site in branch
master(default).
- Your site is published at
https://<username>.github.io
If you wanna store your site in a custom repo, e.g.
mysite:- Create a branch
gh-pages+ set it as default + store your site here.
- Remove content at
url:in_config.yml.
- Your site is live at
https://<username>.github.io/mysite/
- Create file
CNAMEat root and put<customdomain>.comin it.
- Create
AorCNAMErecord in DNS provider. Check more.
- You can also use netlify to set all things up automatically.
- Build your site locally and get a folder
_site.
- Put it to github and see the results.
You can also use
netlify, it accepts custom plugin as well.You can use,
where there is a data file located in
_data/proudof-notes.yml.- How to create customizable Liquid tags in Jekyll by Sverrir Sigmundarson.
- Creating an Accordion Plugin for Jekyll by Mike Lui.
Inside folder
_plugins, create a file thi_single_tag.rb whose content is,Inside folder
_plugins, create a file thi_badge.rb whose content is,For example, we wanna create a custom block
alertbox using class from Bootstrap.Inside folder
_plugins, create a file thi_alert.rb whose content is,A more complicated example, suppose that you wanna create a hide/show box{:.tbrown} using Bootstrap's Collapse, you can use below shortcode. Its advantage is that you don't have to put manually the
id for each box! Wonderful!Inside folder
_plugins, create a file thi_hideshowbox.rb whose content is,💡 Actually, there is a simpler solution for this task. We can get
by using
Somtimes, we cannot use
markdown="1" directly in ruby file. For example, below block of code produces a block of codes (<pre>) instead of a single text,Instead, we change a little bit like this,
Inside the root folder, create a folder named
_drafts. You can put your draft posts inside this folder and whenever you wanna show it in your site, use this command,In the case you have already build your site (all new posts are rendered to
_site), you only changes some small things in some post and you don't want jekyll to render again all things on your site (just look at your current post), use this,For a block, we use
markdown="1"For a tag, we use
markdown="span"Download [lunr.min.js]({{ site.baseurl }}/js/lunr.min.js) and [search.js]({{ site.baseurl }}/js/search.js) and put them in
root/js/. The newest version of lunrjs given here but I'm not sur if it works with this technique or not.Create a file
search.html in the root folder with content:Note that, you can change some personal settings in the files
search.js and search.html if you like.Remark: if your site has so many posts, you can remove the last line (
"content"....) to ignore the content from the search. You can even add "keywords" (resplace for "content") and put that "keywords" in the frontmatter, change also the term "content" in search.js by "keywords". That's what I did on this site.