Nikola を windows でやるぞ [0]
割とこれの続き:
Hyde も python2 仕様でした
はい(はいじゃないが)
もうあとNikolaくらいしか残ってへん…
cf Pelican: Pelican Static Site Generator, Powered by Python
Nikola のがオシャンティーですよね。さらに、
Creating a Site (Not a Blog) with Nikola | Nikola
ドキュメントの目のつきやすいところに「(ブログじゃなくて)サイトをNikolaでつくる」ってのがあるのは要求にぴったり!
そうと決まればインスコだ
当方 windows 10 で python 3.5
virtualenv は使わずに、Anaconda3 さまの仮想環境機能を使いますわ~
参考:
iuk.hateblo.jp
conda create -n nikola python=3.5
これで "nikola" という名の仮想環境ができるので、activate nikola
で環境に入れまふ。
公式(Getting Started | Nikola)に従うとしよう。なになに
Nikola supports Windows! Keep in mind, though, that there are some caveats
"supports" の文字が心強みある。とりあえず、後々必要になるっぽいので、lxml
と Pillow
をインストール。
pip install Pillow
OK。ひきつづいて lxml
もインストールしようと思ったら、エラー。しゃあないので公式の仰せのままに
http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
から、所定のやつ(cpXX は python のバージョンなので、おかゆは cp35 の amd64 のやつ)ダウソして、ダウソしたところにフォルダ移動して、
pip install lxml-3.6.4-cp35-cp35m-win_amd64.whl
すんなり入ったので、本体+αをいれる。公式によれば、Nikola[extras]
ってのをインストールするのがいいらしいので
pip install pip install Nikola[extras]
なんかちょっと引くくらいめっちゃ色々インストールされました。
つくる
公式の通りにする
> nikola init --demo my-site Creating Nikola Site ==================== This is Nikola v7.8.1. We will now ask you a few easy questions about your new site. If you do not want to answer and want to go with the defaults instead, simply restart with the `-q` parameter. --- Questions about the site --- Site title [My Nikola Site]: iuk site Site author [Nikola Tesla]: iuk Site author\'s e-mail [n.tesla@example.com]: Site description [This is a demo site for Nikola.]: Site URL [https://example.com/]: Enable pretty URLs (/page/ instead of /page.html) that don\'t need web server configuration? [Y/n] --- Questions about languages and locales --- We will now ask you to provide the list of languages you want to use. Please list all the desired languages, comma-separated, using ISO 639-1 codes. The first language will be used as the default. Type '?' (a question mark, sans quotes) to list available languages. Language(s) to use [en]: ja Please choose the correct time zone for your blog. Nikola uses the tz database. You can find your time zone here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones Time zone [Asia/Tokyo]: Current time in Asia/Tokyo: 13:49:32 Use this time zone? [Y/n] --- Questions about comments --- You can configure comments now. Type '?' (a question mark, sans quotes) to list available comment systems. If you do not want any comments, just leave the field blank. Comment system: That\'s it, Nikola is now configured. Make sure to edit conf.py to your liking. If you are looking for themes and addons, check out https://themes.getnikola.com/ and https://plugins.getnikola.com/. Have fun! [2016-10-26T04:49:56Z] INFO: init: A new site with example data has been created at my-site. [2016-10-26T04:49:56Z] INFO: init: See README.txt in that folder for more information.
対話で最初のもろもろを答えていって設定していく感じ。これがうざいなら --quiet
にするといいらしい。
びるどる
つくったサイトのフォルダ(おかゆならmy-site
)に移動して nikola build
ムキムキになりましたね。
みる
nikola serve
あるいは自動生成したいなら nikola auto
windows だと jekyll はデフォルトで自動生成してくんないから、これだけでも高まりますね~。
見てみると、なんかオシャンティーなサイトができあがってました。--demo
のちからってすげー!
ちなみに、--browser
(-b
も可)をつけると、ブラウザで自動でページを開いてくれます。優しすぎかよ
markdown をつかう
んー。markdown は Nikola 入れたついでにインストールされてたので、そこはOKだと思われ。conf.py
を
POSTS = ( ("posts/*.md", "posts", "post.tmpl"), # 追加 ("posts/*.rst", "posts", "post.tmpl"), ("posts/*.txt", "posts", "post.tmpl"), ("posts/*.html", "posts", "post.tmpl") ) PAGES = ( ("pages/*.md", "pages", "story.tmpl"), # 追加 ("pages/*.rst", "pages", "story.tmpl"), ("pages/*.txt", "pages", "story.tmpl"), ("pages/*.html", "pages", "story.tmpl") )
にした。ちなみに、POSTS, PAGES の1番目の拡張子がデフォルト的になる。.rst
をデフォルトにしたい人は .rst
を一番上にしておいてね。
大体これで準備は完了したのではなかろうか…? conf.py
に情報がクソほどあったので、それを読むといいかもしれない。