Hugoでサイトを作成し、記事を投稿する
新しいサイトを作成
hugo new site keeplogs
作成したサイトのディレクトリに移動
cd keeplogs
新しいテーマを作成
hugo new theme keeplogs
デフォルトコンテンツの移動
テーマのデフォルトコンテンツを content/
ディレクトリに移動します。
mv themes/keeplogs/content .
デフォルトの投稿データを退避
mv content/posts posts-example
記事用ディレクトリを作成
mkdir content/posts
hugo.toml
を編集して基本設定を行う
baseURL = 'https://keeplogs.com/'
languageCode = 'ja'
title = 'Keep Logs'
theme = 'keeplogs'
新しい記事を作成
以下のコマンドで、新しい記事 content/posts/2025-02-01.md
を作成します。
hugo new content posts/2025-02-01.md
+++
date = "2025-02-01T00:00:00+09:00"
draft = true
title = "2025-02-01"
+++
注意
draft: true
のままだと公開されないため、公開時にはfalse
に変更する必要があります。
サーバーを起動
開発用サーバーを起動します。
hugo server --buildDrafts --buildFuture
サーバーが起動すると、以下のURLでサイトを確認できます。
Tags: