ウェブサイトのセットアップ

ウェブサイトのセットアップ

October 21, 2020

このウェブサイトは、 https://themes.gohugo.io/theme/hugo-book/ を元に作った。 そのときの備忘録をこの記事に残しておく。

インストール #

  1. https://github.com/spf13/hugo/releases から実行ファイルを取得
    • 手元の環境は Windows 10 64bit なので、hugo_0.76.5_Windows-64bit を選択
  2. hugo.exe を適当なディレクトリに置き、パスを通す

サイトの作成 #

  1. サイトを作る
    hugo new site [サイト名]
    
  2. 作成したサイトのディレクトリで git init して、そこを Git のリポジトリにする

テーマの適用 #

  1. https://themes.gohugo.io/hugo-book/ を適用する
    git submodule add https://github.com/alex-shpak/hugo-book themes/book
    
  2. https://github.com/alex-shpak/hugo-book にある説明を見て記事を作成

サイトのプレビューと生成 #

  • プレビュー
    hugo server
    
  • public ディレクトリにサイトを生成
    hugo
    

生成されたサイトを GitHub Pages として公開 #

  1. GitHub Pages用のリポジトリを作成
    • GitHub へアクセスし、[ユーザー名].github.io という名前のリポジトリを公開設定で作成
  2. submodule として, public ディレクトリを 1. で作成したリポジトリに割り当てる
    git submodule add -b main https://github.com/[ユーザー名]/[ユーザー名].github.io public
    
  3. public ディレクトリへ移動し, その中身を git push
    git push origin main
    
  4. https://[ユーザー名].github.io/ に記事が公開される