Overview
Challenges
- 隨著 blog post 越來越多, content/posts 下的 md 會越來越多, 想要好好整理一個大分類, 方便後續文章管理
Objectives
- 建立 content/posts 分類 folder structure, 並與 series 相對應
KRs
- 2022-08-07 分類所有 blog posts
Content
實戰: 調整目錄結構
All content for your website will live inside this directory. Each top-level folder in Hugo is considered a content section.
For example, if your site has three main sections—blog, articles, and tutorials—you will have three directories at content/blog, content/articles, and content/tutorials. Hugo uses sections to assign default content types.
- Hugo is built around content organized in sections.
- A content type is a way to organize your content.
- 善用 Archetypes 幫你快速產生文章範本
- Archetypes are templates used when creating new content.
- 每份 md 裡的
type
好像也可以拿來用作分類使用
Hugo generates a section tree that matches your content.
A Section is a collection of pages that gets defined based on the organization structure under the content/ directory.
實際上就是直接在
content
底下開資料夾, 並且加入_index.md
就可以了!
config.toml
我們要在 config.toml 新增 menu.main, 讓他能在 navigation bar 顯現
- Hugo includes support for user-defined taxonomies.
- Hugo includes support for user-defined groupings of content called taxonomies. Taxonomies are classifications of logical relationships between content.
Other Reference: 深入瞭解 Hugo 設計
- Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site.
- The illustration shows three bundles. Note that the home page bundle cannot contain other content pages, although other files (images etc.) are allowed.
1 2 3 4 5 6 7 8 9 10 11 12
. └── content └── about | └── index.md // <- https://example.com/about/ ├── posts | ├── firstpost.md // <- https://example.com/posts/firstpost/ | ├── happy | | └── ness.md // <- https://example.com/posts/happy/ness/ | └── secondpost.md // <- https://example.com/posts/secondpost/ └── quote ├── first.md // <- https://example.com/quote/first/ └── second.md // <- https://example.com/quote/second/
- A Branch Bundle is any directory at any hierarchy within the
content/
directory, that contains at least an_index.md
file.
- A Branch Bundle is any directory at any hierarchy within the
Conclusion
實際會動到的 code
- 創建
content/
下的 folder, 並加上_index.md
. git commit - feat: add sections - 調整
config.toml
, 使之顯示在 nav bar. git commit - feat: rearrange order weight of nav bar
Discussion
Ref
Murmur
- 2022-08-07 整理癖…