コンテンツにスキップ

「Jekyll」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
編集の要約なし
リダイレクト
タグ: 新規リダイレクト
 
(3人の利用者による、間の5版が非表示)
1行目: 1行目:
#REDIRECT [[アプリケーション一覧/インターネット#静的サイトジェネレーター]]
[[Category:ウェブサーバー]]
[[en:Jekyll]]
[http://jekyllrb.com/ Jekyll] はシンプルなブログなどの静的サイト作成プログラムです。Ruby で書かれており GitHub の共同創立者 [http://tom.preston-werner.com/ Tom Preston-Werner] によって開発されました。テンプレートディレクトリ (ウェブサイトの型を記述します) を使って、Textile や Markdown と Liquid コンバーターで動作し、Apache などのウェブサーバーで公開できる完全な静的ウェブサイトを吐き出します。Jekyll は [http://pages.github.com/ GitHub Pages] で使われているエンジンでもあります。

Werner は Jekyll のリリースを [http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html 彼のウェブサイト] で2008年11月17日に発表しました。

== インストール ==

Jekyll は [[Wikipedia:RubyGems|RubyGems]] パッケージマネージャや [[AUR]] のパッケージを使うことで Arch Linux にインストールできます。どちらの方法を使うにしても公式リポジトリの Ruby パッケージをインストールする必要があります。

=== RubyGems (推奨) ===

{{Note|RubyGems 1.8 以上では [https://github.com/rspec/rspec-core/issues/345 数多の警告] が表示されます。}}
Jekyll をインストールする一番の方法は [[Ruby]] プログラミング言語のパッケージマネージャである [[Ruby#RubyGems|RubyGems]] を使うことです。RubyGems は[[公式リポジトリ]]の {{Pkg|ruby}} パッケージで一緒にインストールされます。root で {{ic|gem}} コマンドを使うことでマシンの全てのユーザーから利用できるように Jekyll をインストールすることができます。別のインストール方法は [[Ruby#RubyGems|Ruby]] ページにあります。

Jekyll をインストールする前に RubyGems のアップデートを行って下さい:

$ gem update

それから {{ic|gem}} コマンドを使って Jekyll をインストールします:

$ gem install jekyll

Arch における Gem の管理についての情報は [[Ruby#RubyGems]] を参照。

=== AUR (別の方法) ===

もしくは、[[AUR]] から {{AUR|ruby-jekyll}} をインストールしてください。

=== Rubygems バイナリリポジトリ ===

非公式の [[非公式ユーザーリポジトリ#quarry|quarry]] リポジトリから ''ruby-jekyll'' を[[インストール]]してください。

== マークアップ言語の選択 ==

There are numerous different markup languages that are used to define text-to-HTML conversion tools. Jekyll has two defaults; [[Wikipedia:Textile (markup language)|Textile]] and [http://daringfireball.net/projects/markdown/ Markdown]. Implementations of both are required as dependencies of Jekyll.

=== Textile ===

[[Wikipedia:Textile (markup language)|Textile]] is a markup language used by Jekyll.
{{note|RedCloth, a module for using the Textile markup language in Ruby, fails to install with gcc 4.6.0 (see: [http://jgarber.lighthouseapp.com/projects/13054/tickets/215-native-ext-compilation-failure RedCloth Ticket 215] and [http://jgarber.lighthouseapp.com/projects/13054/tickets/219-427-installation-issue-on-arch-linux-x64 219]). It is recommended that you install the current stable version 4.2.2 by {{ic|gem install RedCloth --version 4.2.2}}.}}

=== Markdown ===

[http://daringfireball.net/projects/markdown/ Markdown] is a markup language and text-to-HTML conversion tool developed in Perl by [http://daringfireball.net/ John Gruber]. A Perl and a Python implementation of Markdown can be found in the official repositories, while numerous other implementations are available in the [https://aur.archlinux.org/packages.php?O=0&K=markdown&do_Search=Go AUR]. The default implementation of Markdown in Jekyll is [http://maruku.rubyforge.org/index.html Maruku].

Additionally, it has been implemented in C as [http://www.pell.portland.or.us/~orc/Code/discount/ Discount] by [http://www.pell.portland.or.us/~orc/ David Parsons] and a Ruby extension was written by [http://tomayko.com/ Ryan Tomayko] as [https://github.com/rtomayko/rdiscount RDiscount]. You can install RDiscount with Rubygems as root '''or''' through {{Pkg|ruby-rdiscount}} package.
# gem install rdiscount -s <nowiki>http://gemcutter.org</nowiki>
Then add the following line to your {{ic|_config.yml}}.
markdown: rdiscount

If you are unfamiliar with Markdown, Gruber's [http://daringfireball.net/projects/markdown/basics website] presents an excellent introduction. Additionally, you can try out Markdown using Gruber's online [http://daringfireball.net/projects/markdown/dingus conversion tool].

== 設定 ==

デフォルトの Jekyll のディレクトリツリーは以下のようになっています。"." は Jekyll が生成したウェブサイトのルートディレクトリを示しています。
.
|-- _config.yml
|-- _layouts
| |-- default.html
| `-- post.html
|-- _posts
| |-- 2010-02-13-early-userspace-in-arch-linux.textile
| `-- 2011-05-29-arch-linux-usb-install-and-rescue-media.textile
|-- _site
`-- index.html
A default file structure is available from Daniel McGraw's [https://github.com/danielmcgraw/Jekyll-Base Jekyll-Base] page on GitHub.
{{note|McGraw has also setup a more extensive default file structure on [https://github.com/danielmcgraw/danielmcgraw.com.git GitHub].}}

The {{ic|_config.yml}} file stores configuration data. It includes numerous configuration settings, which may also be called as flags. Full explanation and a default configuration can be found on
[https://github.com/mojombo/jekyll/wiki/Configuration GitHub].

Once you have configured your {{ic|_config.yml}} to your liking you need to create the files that will be processed by Jekyll to generate the website.

== 使用方法 ==

Next you need to create templates that Jekyll can process. These templates make use of the Liquid templating system to input data. For a full explanation check [https://github.com/mojombo/jekyll/wiki/template-data GitHub].

Additionally, each file besides {{ic|/_layouts/layout.html}} requires a [https://github.com/mojombo/jekyll/wiki/yaml-front-matter YAML Front Matter] heading.

=== インデックスレイアウトを作成 ===

This is a basic template for your {{ic|index.html}}, which is used to render your website's index page.
{{bc|<nowiki>
---
layout: layout
title: Jekyll Base
---

<div class="content">
<div class="related">
<ul>
{% for post in site.posts %}
<li>
<span>{{ post.date | date: "%B %e, %Y" }}</span> <a href="{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</nowiki>}}

=== 一般的なウェブサイトのレイアウトを作成 ===

This is a basic template for your website's general layout. It will be referenced in the [[Wikipedia:YAML|YAML]] Front Matter blocks of each file (see: [[#記事を作成|Creating a Post]]).
{{hc|_layouts/layout.html|<nowiki>
<!DOCTYPE HTML>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="Your Name" />
<title>{{ page.title }}</title>
</head>
<body>
<header>
<h1><a href="/">Jekyll Base</a></h1>
</header>
<section>
{{ content }}
</section>
</body>
</html>
</nowiki>}}

=== 記事のレイアウトを作成 ===

This is a basic template for each of your posts. Again, this will be referenced in the [[Wikipedia:YAML|YAML]] Front Matter blocks of each file (see: [[#記事を作成|Creating a Post]]).
{{hc|_layouts/post.html|<nowiki>
---
layout: layout
title: sample title
---

<div class="content">
<div id="post">
<h1>{{ post.title }}</h1>
{{ content }}
</div>
</div>
</nowiki>}}

=== 記事を作成 ===

The content of each blog post will be contained within a file inside of the {{ic|_posts}} directorys. To use the default naming convention each file should be saved with the year, month, date, post title and end with the *.md or *.textile depending on the markup language used (e.g. {{ic|2010-02-13-early-userspace-in-arch-linux.textile}}). The date defined in the filename will be used as the published date in the post. Additionally, the filename will be used to generate the permalink (i.e. /categories/year/month/day/title.html). To use an alternate permalink style or create your own review the explanation on [https://github.com/mojombo/jekyll/wiki/Permalinks GitHub].

== テスト ==

Textile や Markdown ドキュメントを元に静的な HTML ウェブサイトを生成するには {{ic|jekyll}} を実行してください。{{ic|--serve}} フラグを付けて Jekyll を実行することで生成した HTML ウェブサイトのテストを同時に行えます。
$ jekyll serve
もしくは jekyll にファイルの変更を監視して欲しい場合:
$ jekyll serve --watch
{{ic|_config.yml}} でサーバーのオプションを定義することを推奨します。デフォルトではポート 4000 でサーバーが起動し、ウェブブラウザで {{ic|localhost:4000}} を開くことでアクセスできます。

== 参照 ==

* [[Wikipedia:ja:YAML|YAML]]
* [[Wikipedia:Textile (markup language)|Textile]]
* [http://danielmcgraw.com/2011/04/14/The-Ultimate-Guide-To-Getting-Started-With-Jekyll-Part-1/ Installation Tutorial] by Daniel McGraw
* [http://danielmcgraw.com/2011/04/18/The-Ultimate-Guide-To-Getting-Started-With-Jekyll-Part-2/ Configuration Tutorial] by Daniel McGraw
* [http://philipm.at/2011/0507/ Jekyll vs. Hyde] by Philip Mateescu
* Jekyll で作成されたウェブサイトは [https://github.com/mojombo/jekyll/wiki/sites GitHub] で見つけられます
* 必要なソフトウェア:
** http://redcloth.org - RedCloth
** http://www.liquidmarkup.org/ - Liquid
** http://classifier.rubyforge.org/ - Classifier
** http://maruku.rubyforge.org/maruku.html - Maruku
** http://pygments.org/ - Pygments
** http://rubygems.org/gems/directory_watcher - Directory Watcher

2023年11月28日 (火) 20:59時点における最新版