From a70f200944454fbcd70d8786b8fa106b64af66b3 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 18 Aug 2023 09:36:44 -0700 Subject: [PATCH] Use "hugo new content" to create content --- content/en/content-management/archetypes.md | 14 +++++++------- content/en/content-management/multilingual.md | 10 +++++----- content/en/getting-started/directory-structure.md | 2 +- content/en/getting-started/quick-start.md | 2 +- content/en/showcase/template/index.md | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/content/en/content-management/archetypes.md b/content/en/content-management/archetypes.md index d8c864536..99a6a4e89 100644 --- a/content/en/content-management/archetypes.md +++ b/content/en/content-management/archetypes.md @@ -15,14 +15,14 @@ aliases: [/content/archetypes/] ## What are archetypes? -**Archetypes** are content template files in the [archetypes directory] of your project that contain preconfigured [front matter] and possibly also a content disposition for your website's [content types]. These will be used when you run `hugo new`. +**Archetypes** are content template files in the [archetypes directory] of your project that contain preconfigured [front matter] and possibly also a content disposition for your website's [content types]. These will be used when you run `hugo new content`. -The `hugo new` uses the `content-section` to find the most suitable archetype template in your project. If your project does not contain any archetype files, it will also look in the theme. +The `hugo new content` command uses the `content-section` to find the most suitable archetype template in your project. If your project does not contain any archetypes, it will also look in the theme. -{{< code file="archetype-example.sh" >}} -hugo new posts/my-first-post.md -{{< /code >}} +```text +hugo new content posts/my-first-post.md +``` The above will create a new content file in `content/posts/my-first-post.md` using the first archetype file found of these: @@ -56,7 +56,7 @@ draft: true When you create a new newsletter with: ```bash -hugo new newsletter/the-latest-cool.stuff.md +hugo new content newsletter/the-latest-cool.stuff.md ``` It will create a new newsletter type of content file based on the archetype template. @@ -80,7 +80,7 @@ archetypes ``` ```bash -hugo new --kind post-bundle posts/my-post +hugo new content --kind post-bundle posts/my-post ``` Will create a new folder in `/content/posts/my-post` with the same set of files as in the `post-bundle` archetypes folder. All content files (`index.md` etc.) can contain template logic, and will receive the correct `.Site` for the content's language. diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index cacd6804c..ec187d663 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -641,20 +641,20 @@ To support Multilingual mode in your themes, some considerations must be taken f If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string (and is therefore harmless for single-language Hugo websites). -## Generate multilingual content with `hugo new` +## Generate multilingual content with `hugo new content` If you organize content with translations in the same directory: ```text -hugo new post/test.en.md -hugo new post/test.de.md +hugo new content post/test.en.md +hugo new content post/test.de.md ``` If you organize content with translations in different directories: ```text -hugo new content/en/post/test.md -hugo new content/de/post/test.md +hugo new content content/en/post/test.md +hugo new content content/de/post/test.md ``` [abslangurl]: /functions/abslangurl diff --git a/content/en/getting-started/directory-structure.md b/content/en/getting-started/directory-structure.md index fa4babe6a..676b7bd1c 100644 --- a/content/en/getting-started/directory-structure.md +++ b/content/en/getting-started/directory-structure.md @@ -37,7 +37,7 @@ example/ The following is a high-level overview of each of the directories with links to each of their respective sections within the Hugo docs. [`archetypes`](/content-management/archetypes/) -: You can create new content files in Hugo using the `hugo new` command. +: You can create new content files in Hugo using the `hugo new content` command. By default, Hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes] with custom preconfigured front matter fields as well. [`assets`] diff --git a/content/en/getting-started/quick-start.md b/content/en/getting-started/quick-start.md index b00851bae..24f2ba1fc 100644 --- a/content/en/getting-started/quick-start.md +++ b/content/en/getting-started/quick-start.md @@ -103,7 +103,7 @@ Press `Ctrl + C` to stop Hugo's development server. Add a new page to your site. ```text -hugo new posts/my-first-post.md +hugo new content posts/my-first-post.md ``` Hugo created the file in the `content/posts` directory. Open the file with your editor. diff --git a/content/en/showcase/template/index.md b/content/en/showcase/template/index.md index 72707bfde..4dc662332 100644 --- a/content/en/showcase/template/index.md +++ b/content/en/showcase/template/index.md @@ -11,7 +11,7 @@ Have a **notable Hugo site[^1]**? We would love to feature it in this **Showcase Please: 1. Fork https://github.com/gohugoio/hugoDocs. -2. Run `hugo new showcase/your-site`. This will use the archetype bundle in the [docs repo](https://github.com/gohugoio/hugoDocs/tree/master/archetypes). +2. Run `hugo new content showcase/your-site`. This will use the archetype bundle in the [docs repo](https://github.com/gohugoio/hugoDocs/tree/master/archetypes). 3. Follow the instructions in the newly created page bundle. 4. Create a new pull request in https://github.com/gohugoio/hugoDocs/pulls.