LoginSignup
1
0

More than 3 years have passed since last update.

hugoでその日の記事がビルドされない問題を回避する

Last updated at Posted at 2019-12-08

hugoは、その日の記事がビルドされない問題があります。その回避法です。

config.toml
[frontmatter]
date  = [":filename", ":default"]

ファイルはcontent/post/2019-12-09-test.md(その日の日付)とします。

content/post/2019-12-09-test.md
date = "2019-12-09T08:00:00JST"

hugoでその日の記事がビルドされない問題

これは、UTCがデフォルトになっているためだと思いますが、hugoでは、通常、.Date.Localを使っても、その日の記事がビルドされない問題があります。

layout/_default/list.html
{{ dateFormat "2006-01-02T15:04:05JST" .Date.Local }}

そこで、dateをファイル名から取得する方法に切り替えると、回避できます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0