YehYeh 記事本2.0

Version 0.8.3

竹科碼農的記事本

Hugo 新增一篇文章

front matter

  • 用hugo new建立新post時,hugo會自動在新檔案中的最上面加入front matter
  • EX:
hugo new post/my-first-post.md

以下即為 my-first-post.md 的 front matter

---
title: "新增一篇文章"
date: 2020-03-22T11:13:57+08:00
lastmod: 2020-03-22T11:13:57+08:00
publishdate: 2020-03-22T11:13:57+08:00
description: ""
weight: 4
---

新增一篇文章

  • 每種佈景需要的front matter不太一樣
  • Hugo會在 archetypes 裡,用下面的順序來找適合的檔案
    1. archetypes/post.md
    2. archetypes/default.md
    3. themes//archetypes/posts.md
    4. themes//archetypes/default.md
  • 所以一般都要把佈景對應的 archetypes 裡的檔案覆蓋到根目錄的 archetypes

新增在content資料夾

文章要放在那個資料夾,要看使用的佈景

hugo new 路徑/檔名.md

新增在content資料夾的post目錄

hugo new post/路徑/檔名.md
Last updated on 2020-03-22
Published on 2020-03-22
Edit on GitHub