From cea93ebe84ac018c61d952fe13564a2c939c0fe4 Mon Sep 17 00:00:00 2001 From: Ryan Watters Date: Tue, 4 Jul 2017 23:19:03 -0500 Subject: [PATCH] Update archetypes documentation for v0.24 --- content/content-management/archetypes.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/content-management/archetypes.md b/content/content-management/archetypes.md index a8917e3db..0f526cfc7 100644 --- a/content/content-management/archetypes.md +++ b/content/content-management/archetypes.md @@ -60,7 +60,7 @@ The auto-populated fields are worth examining: * `title` is generated from the new content's filename (i.e. in this case, `my-first-post` becomes `"my first post"`) * `date` and `title` are the variables that ship with Hugo and are therefore included in *all* content files created with the Hugo CLI. `date` is generated in [RFC 3339 format][] by way of Golang's [`now()`][] function, which returns the current time. -* The third variable, `draft = true`, is *not* inherited by your default or custom archetypes but is include in Hugo's internal/base archetype for convenience. +* The third variable, `draft = true`, is *not* inherited by your default or custom archetypes but is included in Hugo's automatically scaffolded `default.md` archetype for convenience. Three variables per content file are often not enough for effective content management of larger websites. Luckily, Hugo provides a simple mechanism for extending the number of variables through custom archetypes, as well as default archetypes to keep content creation DRY. @@ -71,14 +71,13 @@ Similar to the [lookup order for templates][lookup] in your `layouts` directory, 1. `archetypes/posts.md` 2. `archetypes/default.md` 3. `themes//archetypes/posts.md` -4. `themes//archetypes/default.md` -5. `_internal` (i.e., `title` and `date`) +4. `themes//archetypes/default.md` (Auto-generated with `hugo new site`) {{% note "Using a Theme Archetype" %}} If you wish to use archetypes that ship with a theme, the `theme` field must be specified in your [configuration file](/getting-started/configuration/). {{% /note %}} -## Choosing Your Front Matter Format +## Choosing Your Archetype's Front Matter Format By default, `hugo new` content files include front matter in the TOML format regardless of the format used in `archetypes/*.md`. @@ -90,6 +89,8 @@ Default archetypes are convenient if your content's front matter stays consisten ### Creating the Default Archetype +When you create a new Hugo project using `hugo new site`, you'll notice that Hugo has already scaffolded a file at `archetypes/default.md`. + The following examples are from a site that's using `tags` and `categories` as [taxonomies][]. If we assume that all content files will require these two key-values, we can create a `default.md` archetype that *extends* Hugo's base archetype. In this example, we are including "golang" and "hugo" as tags and "web development" as a category. {{% code file="archetypes/default.md" %}}