先看下jekyll目前的最新版本和所需ruby的版本,当前jekyll版本v2.5.3,对ruby版本要求是>= 1.9.3
安装ruby>= 1.9.3环境
louxiaojian@dao:~$ sudo apt-get install ruby ruby-dev
先看下jekyll目前的最新版本和所需ruby的版本,当前jekyll版本v2.5.3,对ruby版本要求是>= 1.9.3
louxiaojian@dao:~$ sudo apt-get install ruby ruby-dev
当人们一开始接触各种Web开发语言时,总会发现彻底搞懂不同语言的命名约定是一件很要命的事情。而且当开发者在争论什么才是最佳实践时,事情会变得更加让人困惑。为了让初学者更容易地在不同语言中过渡,这篇文章列出了一些常见的约定。
如果你看到一个变量或者方法是以_开头的,其实这并不代表其幕后有什么猫腻。这仅仅是为了提醒开发者这个变量/属性/方法是私有的(private
)或是受保护的(protected
),它们不能从类的外部访问到。
1
2
3
4
5
6
7
var mustache = require('./node_modules/mustache/mustache');
function helloworld(response)
{
console.log('request recieved at ' + (new Date()).getTime());
response.writeHead(200, {'Content-Type': 'text/html'});
var template = '<h1>Test</h1><p></p>';
var model = {helloworld:'Hello World'};
response.end(mustache.to_html(template,model));
}
exports.helloworld = helloworld;
From:https://github.com/mojombo/jekyll/wiki/Usage
Note: Pagination does not work with markdown files, it only works with html file extensions.
Just follow these steps to add pagination to your blog:
_config.yml
add the pagination setting:
markdown: rdiscount
pygments: true
lsi: true
exclude: ['README.markdown', 'README_FOR_COLLABORATORS.markdown', 'Gemfile.lock', 'Gemfile']
production: false
//add this line to add pagination
paginate: 3 //the number of post per page
From:https://github.com/mojombo/jekyll/wiki/Usage
Creating a Jekyll site usually involves the following, [[once jekyll is installed. Install]]
- Set up the basic structure of the site
Create some posts, or [[import them from your previous platform Blog migrations]]
- Run your site locally to see how it looks
- Deploy your site
Basic Structure
Jekyll at its core is a text transformation engine. The concept behind the system is this: you give it text written in your favorite markup language, be that Markdown, Textile, or just plain HTML, and it churns that through a layout or series of layout files. Throughout that process you can tweak how you want the site URLs to look, what data gets displayed on the layout and more. This is all done through strictly editing files, and the web interface is the final product.
A basic Jekyll site usually looks something like this:
From:https://github.com/mojombo/jekyll/wiki/Template-Data Jekyll traverses your site looking for files to process. Any files with [[YAML Front Matter]] are subject to processing. For each of these files, Jekyll makes a variety of data available to the pages via the "Liquid templating system":http://wiki.github.com/shopify/liquid/liquid-for-designers. The following is a reference of the available data. h2. Global | *Variable* | *Description* | | @site@ | Sitewide information + Configuration settings from @_config.yml@ | | @page@ | This is just the [[YAML Front Matter]] with 2 additions: @url@ and @content@. | | @content@ | In layout files, this contains the content of the subview(s). This is the variable used to insert the rendered content into the layout. This is not used in post files or page files. | | @paginator@| When the @paginate@ configuration option is set, this variable becomes available for use. |