つまずいたところ

 hugo でhtmlを拡張した形で書かれる、テンプレート?を作ろうとしたら、メンドウなことになった。

layouts の html ページの作成

hugo new layouts/baseof.html

はできないことを知らなかったという。ちなみにこれを実行してしまうと一見うまくいったように見えるが、laytouts フォルダではなく、contentフォルダ配下にディレクトリやらファイルやらが生成されてしまうのでめんどくさくなる。

ちなみにミスった時はこうなる

# hugo new layouts/baseof.html
Content "何かしらのパス/content/layouts/baseof.html" created

.
├── archetypes
├── assets
├── content
│   ├── _index.md
│   └── layouts
│       └── baseof.html
├── data
├── hugo.toml
├── i18n
├── layouts
├── public
├── res.txt
├── static
└── themes

一部関係ない部分省略してここには書いてるので、layouts、contentフォルダだけ見てもらえればと思います。

知らなかったこと

hugoでのhtmlの書き方

hugo ではそのままhtmlを今までどおり書くことができるが、他のファイルやforループを行うこともできる。phpみたいなイメージに近いかも。Chat GPTに質問してみたらこんな感じになるらしい。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ .Title }}</title>
    <!-- Additional meta information or stylesheets can be added here -->
    {{- partial "head_custom.html" . -}}
</head>
<body>
    <header>
        <!-- Header content goes here -->
        {{- partial "header_custom.html" . -}}
    </header>

    <main>
        <!-- Content from individual pages will be inserted here -->
        {{- block "main" . }}{{ .Content }}{{ end -}}
    </main>

    <footer>
        <!-- Footer content goes here -->
        {{- partial "footer_custom.html" . -}}
    </footer>

    <!-- Additional scripts or footer scripts can be added here -->
    {{- partial "footer_scripts.html" . -}}
</body>
</html>

ちなみに公式ドキュメントはここら辺っぽい