サクッとHTML

自作のSSG:ディレクトリ構成

公開日:

自作のSSG


contentディレクトリの中に、ディレクトリとmdファイルを格納し、指定のディレクトリごとに個別のHTMLが生成される設計を想定。

  • WordPress だと、「home.php」「page.php」「カテゴリーに記事投稿」のようなイメージ。

個人用途なので「マークダウンをHTML化する」というシンプルな思考をベースとして、古典的なフォルダ構造(ツリー構造)です。

CMS やメジャーな SSG は高機能すぎるので、自作のSSGでは、自分の用途とスキルに見合った最小構成を目指しました。

実際のディレクトリ構成

Root_Dir
│
├── content
│   ├── assets
│   │   ├── img
│   │   ├── apple-touch-icon-180x180.png
│   │   ├── favicon.ico
│   │   ├── icon-192x192.png
│   │   └── style.css
│   │
│   ├── homemade_ssg
│   │   ├── index.md
│   │   ├── ssg_00001.md
│   │   └── ssg_00002.md
│   │
│   ├── python
│   │   ├── index.md
│   │   └── python_00001.md
│   │
│   ├── shell
│   │   ├── index.md
│   │   └── shell_00001.md
│   │
│   ├── about.md
│   ├── index.md
│   ├── menu.md
│   └── sitemap.md
│
├── templates
│   ├── _inc
│   │   └── _nav.txt
│   ├── base.txt
│   ├── index.txt
│   ├── list.txt
│   ├── page.txt
│   ├── post.txt
│   └── sitemap.txt
│
├── config.yaml
└── main.py

ビルド後の public ディレクトリ

public
│
├── homemade_ssg
│   ├── index.html
│   ├── ssg_00001.html
│   └── ssg_00002.html
├── img
├── python
│   ├── index.html
│   └── python_00001.html
├── shell
│   ├── index.html
│   └── shell_00001.html
│
├── about.html
├── apple-touch-icon-180x180.png
├── favicon.ico
├── icon-192x192.png
├── index.html
├── menu.html
├── sitemap.html
└── style.css

シンプルなサイトを管理するための単純で基本的な構造・設計・構成にしています。