2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Hugoではテーマを指定しないとindex.htmlのサイズがゼロで作成される

Posted at

ものすごく基礎的なことだけどちょっとハマったのでメモ。
結論として、テーマをダウンロードして、指定しないとダメですよという話。

対象のVersion

kakkyz@docker:/tmp/hugo$ hugo version
Hugo Static Site Generator v0.14-DEV BuildDate: 2015-05-12T21:40:11+09:00

とりあえずサイトを作って、記事を作成

hugo new site
hugo new

kakkyz@docker:/tmp$ hugo new site /tmp/hugo
kakkyz@docker:/tmp$
kakkyz@docker:/tmp/hugo$ hugo new hoge.md
/tmp/hugo/content/hoge.md created
kakkyz@docker:/tmp/hugo$

vim content/hoge.md

+++
date = "2015-05-17T11:25:14+09:00"
draft = true
title = "hoge"

+++
# my first HUGO

HUGOテスト

テーマを指定せずにファイル作成

-Dオプションは、ドラフトも含めて作成するためのもの

kakkyz@docker:/tmp/hugo$ hugo -D
1 of 1 draft rendered
0 future content
1 pages created
0 paginator pages created
0 categories created
0 tags created
in 117 ms
kakkyz@docker:/tmp/hugo$ ls -lFR public/
public/:
合計 12
-rw-r--r-- 1 kakkyz dev    0  5月 17 11:26 404.html
drwxr-xr-x 2 kakkyz dev 4096  5月 17 11:26 hoge/
-rw-r--r-- 1 kakkyz dev    0  5月 17 11:26 index.html
-rw-r--r-- 1 kakkyz dev  999  5月 17 11:26 index.xml
-rw-r--r-- 1 kakkyz dev  420  5月 17 11:26 sitemap.xml

public/hoge:
合計 0
-rw-r--r-- 1 kakkyz dev 0  5月 17 11:26 index.html
kakkyz@docker:/tmp/hugo$

index.xmlは中身ありだが、index.htmlはサイズが0で中身なしで悪い

テーマのダウンロード

kakkyz@docker:/tmp/hugo$ git clone --recursive https://github.com/spf13/hugoThemes themes
Cloning into 'themes'...
remote: Counting objects: 283, done.
remote: Total 283 (delta 0), reused 0 (delta 0), pack-reused 283
Receiving objects: 100% (283/283), 507.40 KiB | 254.00 KiB/s, done.
Resolving deltas: 100% (136/136), done.
Checking connectivity... done.

テーマを指定してファイル作成

kakkyz@docker:/tmp/hugo$ hugo --theme=greyshade -D
ERROR: 2015/05/17 Site's .BaseUrl is deprecated and will be removed in Hugo 0.15. Use .BaseURL instead.
1 of 1 draft rendered
0 future content
1 pages created
0 paginator pages created
0 categories created
0 tags created
in 104 ms
kakkyz@docker:/tmp/hugo$ ls -lFR public/
public/:
合計 44
-rw-r--r-- 1 kakkyz dev    0  5月 17 11:39 404.html
-rw-r--r-- 1 kakkyz dev  804  5月 17 11:28 config.rb
drwxr-xr-x 2 kakkyz dev 4096  5月 17 11:28 css/
drwxr-xr-x 2 kakkyz dev 4096  5月 17 11:28 font/
drwxr-xr-x 2 kakkyz dev 4096  5月 17 11:26 hoge/
drwxr-xr-x 4 kakkyz dev 4096  5月 17 11:28 images/
-rw-r--r-- 1 kakkyz dev 2375  5月 17 11:39 index.html
-rw-r--r-- 1 kakkyz dev  412  5月 17 11:39 index.xml
drwxr-xr-x 2 kakkyz dev 4096  5月 17 11:28 js/
drwxr-xr-x 3 kakkyz dev 4096  5月 17 11:39 page/
drwxr-xr-x 6 kakkyz dev 4096  5月 17 11:28 sass/
-rw-r--r-- 1 kakkyz dev  420  5月 17 11:39 sitemap.xml

無事作成されて良い

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?