Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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

対象の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

無事作成されて良い

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした