diff --git a/content/content-management/archetypes.md b/content/content-management/archetypes.md index d6d30b3f3..1c473b6b7 100644 --- a/content/content-management/archetypes.md +++ b/content/content-management/archetypes.md @@ -31,14 +31,14 @@ See above The `hugo new` generator for archetypes assumes your working directory is the content folder at the root of your project. Hugo is able to infer the appropriate archetype by assuming the content type from the content section passed to the CLI command: -```bash +``` hugo new / ``` We can use this pattern to create a new `.md` file in the `posts` section: {{% code file="archetype-example.sh" %}} -```bash +``` hugo new posts/my-first-post.md ``` {{% /code %}} @@ -50,7 +50,7 @@ To override the content type Hugo infers from `[content-section]`, add the `--ki Running this command in a new site that does not have default or custom archetypes will create the following file: {{% output file="content/posts/my-first-post.md" %}} -```toml +``` +++ date = "2017-02-01T19:20:04-07:00" title = "my first post" @@ -101,7 +101,7 @@ When you create a new Hugo project using `hugo new site`, you'll notice that Hug 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" %}} -```toml +``` +++ tags = ["golang", "hugo"] categories = ["web development"] @@ -118,7 +118,7 @@ If you get an `EOF error` when using `hugo new`, add a carriage return after the With an `archetypes/default.md` in place, we can use the CLI to create a new post in the `posts` content section: {{% code file="new-post-from-default.sh" %}} -```bash +``` $ hugo new posts/my-new-post.md ``` {{% /code %}} @@ -126,7 +126,7 @@ $ hugo new posts/my-new-post.md Hugo then creates a new markdown file with the following front matter: {{% output file="content/posts/my-new-post.md" %}} -```toml +``` +++ categories = ["web development"] date = "2017-02-01T19:20:04-07:00" @@ -149,7 +149,7 @@ Suppose your site's `posts` section requires more sophisticated front matter tha ### Create a Custom Archetype {{% code file="archetypes/posts.md"%}} -```toml +``` +++ description = "" tags = "" @@ -163,7 +163,7 @@ categories = "" With an `archetypes/posts.md` in place, you can use the Hugo CLI to create a new post with your preconfigured front matter in the `posts` content section: {{% code file="new-post-from-custom.sh" %}} -```bash +``` $ hugo new posts/post-from-custom.md ``` {{% /code %}} @@ -171,7 +171,7 @@ $ hugo new posts/post-from-custom.md This time, Hugo recognizes our custom `archetypes/posts.md` archetype and uses it instead of `archetypes/default.md`. The generated file will now include the full list of front matter parameters, as well as the base archetype's `title` and `date`: {{% output file="content/posts/post-from-custom-archetype.md" %}} -```toml +``` +++ categories = "" date = 2017-02-13T17:24:43-08:00 @@ -187,7 +187,7 @@ title = "post from custom archetype" As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs: {{% code file="archetypes/functions.md" %}} -```yaml +``` {{< readfile file="/themes/gohugoioTheme/archetypes/functions.md" >}} ``` {{% /code %}} diff --git a/content/content-management/authors.md b/content/content-management/authors.md index 80a783912..85606df81 100644 --- a/content/content-management/authors.md +++ b/content/content-management/authors.md @@ -31,7 +31,7 @@ You can create a profile containing metadata for each author on your website. Th Let's suppose Alice Allison is a blogger. A simple unique identifier would be `alice`. Now, we have to create a file called `alice.toml` in the `data/_authors/` directory. The following example is the standardized template written in TOML: {{% code file="data/_authors/alice.toml" %}} -```toml +``` givenName = "Alice" # or firstName as alias familyName = "Allison" # or lastName as alias displayName = "Alice Allison" @@ -67,7 +67,7 @@ The `params` section can contain arbitrary data much like the same-named section Earlier it was mentioned that content can be associated with an author through their corresponding identifier. In our case, blogger Alice has the identifier `alice`. In the front matter of a content file, you can create a list of identifiers and assign it to the `authors` variable. Here are examples for `alice` using YAML and TOML, respectively. -```yaml +``` --- title: Why Hugo is so Awesome date: 2016-08-22T14:27:502:00 @@ -77,7 +77,7 @@ authors: ["alice"] Nothing to read here. Move along... ``` -```toml +``` +++ title = Why Hugo is so Awesome date = "2016-08-22T14:27:502:00" @@ -117,7 +117,7 @@ This is can be done with the `.Social.URL` function. Its only parameter is the n Most articles feature a small section with information about the author at the end. Let's create one containing the author's name, a thumbnail, a (summarized) biography and links to all social networks: {{% code file="layouts/partials/author-info.html" download="author-info.html" %}} -```html +``` {{ with .Author }}

{{ .DisplayName }}

{{ .DisplayName }} @@ -137,12 +137,12 @@ That question can be answered with a list of all authors and another list contai In order to let Hugo know that we want to group content based on their author, we have to create a new taxonomy called `author` (the name corresponds to the variable in the front matter). Here is the snippet in a `config.yaml` and `config.toml`, respectively: -```yaml +``` taxonomies: author: authors ``` -```toml +``` [taxonomies] author = "authors" ``` @@ -153,7 +153,7 @@ taxonomies: In the next step we can create a template to list all authors of your website. Later, the list can be accessed at `www.example.com/authors/`. Create a new template in the `layouts/taxonomy/` directory called `authors.term.html`. This template will be exclusively used for this taxonomy. {{% code file="layouts/taxonomy/author.term.html" download="author.term.html" %}} -```html +```