Hugo v0.24 リリース
Archetypesの見直されます!
This is The Revival of the Archetypes!
HugoはArchetypeファイルをGoテンプレートとして扱います。これはソートやコメントを失う問題が無くなることを意味します。しかし、これはまた新しいウィンドウをたくさん開いてしまいます。
セクションが newsletter
で archetypeが archetyes/newsletter.md
の架空の例:
A fictional example for the section newsletter and the archetype file archetypes/newsletter.md:
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
draft: true
---
**Insert Lead paragraph here.**
<!-- more -->
## New Cool Posts
{{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }}
* {{ .Title }}
{{ end }}
で、新しいポストを作る:
And then create a new post with:
hugo new newsletter/the-latest-cool.stuff.md
注意: サイトは .Site
がarchetypeファイルで使われているときのみ使われますが、その場合に大きなサイトでは時間がかかることがあります。
Note: the site will only be built if the .Site is in use in the archetype file, and this can be time consuming for big sites.
ヒント: もし newContentEditor
をPATHに設定されているEditorに設定されていると、新しい記事がオープンされます。
Hot Tip: If you set the newContentEditor configuration variable to an editor on your PATH, the newly created article will be opened.
上記のニュースレターは可能性を秘めています。Hugoの .Site
とテンプレート関数は、全てArchetypeファイルで使用できます。
The above newsletter type archetype illustrates the possibilities: The full Hugo .Site and all of Hugo's template funcs can be used in the archetype file.
また、HugoはMarkdownのみならず、全てのコンテンツフォーマットのArchetypeをサポートしています。
Also, Hugo now supports archetype files for all content formats, not just markdown.
ノート
- Archetypeファイルは
title
とdate
を含むことが必要です。 - Archetype files now need to be complete, including title and date.
- The -f (format) flag は削除されました。archetypeファイルのみが使えます。
- The -f (format) flag in hugo new is removed: Now use the archetype files as is.
強化
- 拡張子のないメディアタイプをサポートします。Netlifyの_redirectsファイルをサポートすることでサーバーサイドでのリダイレクトを作成することができます。 #3614
Support extension-less media types. The motivation behind this change is to support Netlify's _redirects files, so we can generate server-side redirects for the Hugo docs site. See this commit to see how we configured that. 0f40e1fa @bep #3614
Add disableAliases 516e6c6d @bep #3613
Support non-md files as archetype files 19f2e729 @bep #3597 #3618
Identify extension-less text types as text c43b512b @bep #3614
Add .Site to the archetype templates 662e12f3 @bep #1629
Use archetype template as-is as a Go template 422057f6 @bep #452 #1629
Update links to new discuss URL 4aa12390 @bep
このアップデートは定形文を作るのに便利そう。このHugoリリース和訳もこの機能で作り直すといいかもね。