Describe the use of custom archetypes in the docs - hugo - [fork] hugo port for 9front
(HTM) git clone git@git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit d584ca59f03730431b71f6d1fa9620f7f7fc84fb
(DIR) parent 16cbda979c4aaa188ea27f5f74a3cf8e4a4b092c
(HTM) Author: digitalcraftsman <digitalcraftsman@users.noreply.github.com>
Date: Mon, 24 Aug 2015 13:29:45 +0200
Describe the use of custom archetypes in the docs
Diffstat:
M docs/content/content/archetypes.md | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/docs/content/content/archetypes.md b/docs/content/content/archetypes.md
@@ -56,8 +56,35 @@ Hugo would create the file with the following contents:
We see that the `title` and `date` variables have been added, in addition to the `tags` and `categories` variables which were carried over from `archetype/default.md`.
-Congratulations! We have successfully created an archetype and used it for our new contents. That's all there is to it!
+Congratulations! We have successfully created an archetype and used it for our new contents. But wait, what if I want to have different variables for another content type, like musicians? No problem.
+### Creating custom archetypes
+
+Earlier you created a new content type by adding a new subfolder to the content directory. In our case it's name would be `content/musician`. To use the corresponding archetype you just need to create a file named after the content type called `musician.md` in the `archetypes` directory, similar to the one below.
+
+#### archetypes/musician.md
+
+ +++
+ name = ""
+ bio = ""
+ genre = ""
+ +++
+
+Now let's create a new musician.
+
+ $ hugo new musician/mozart.md
+
+This time, Hugo recognizes the custom archetype and uses it instead of the default one. So the generated file's frontmatter now includes the variables `name`, `bio` and `genre`.
+
+#### content/musician/mozart.md
+
+ +++
+ title = "mozart"
+ date = "2015-08-24T13:04:37+02:00"
+ name = ""
+ bio = ""
+ genre = ""
+ +++
## Using a different front matter format