mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-13 15:59:42 -04:00
Use "hugo new content" to create content
This commit is contained in:
parent
673846ff95
commit
a70f200944
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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`]
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user