Theme

サイトの見た目を変更する

1. テーマを探す

公式のComplete List | Hugo Themesに、いろいろなテーマがあるので、お気に入りのものを探します。

2. テーマのダウンロード

2.1. ファイルをダウンロードして追加

テーマのgithubページから、ZIPファイルをダウンロードして、解凍し、theme内に設置します。

2.2. submoduleで追加

git submoduleコマンドでダウンロードもできます。

> git submodule add <git repository> <path>

3. テーマの適用

3.1. config.toml

ダウンロードしたテーマを、作成しているサイトのテーマとして設定するには、config.tomlに指定する必要があります。

theme = "<theme name>"

shellから追記する方法はこちら。

echo theme = \"<theme name>\" >> config.toml

3.2. --themeオプション

一時的にテーマを適用するなど、config.tomlに記載したテーマとは別のテーマを使用したい場合は、--themeもしくは-tオプションが使用できます。

hugo server --theme <theme name>
hugo server -t <theme name>

4. Ref.

Quick Start Step 3: Add a Theme| Hugo

See Also