mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-25 07:48:52 +00:00
Add table of contents first attempt
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: License
|
||||
title: Apache License
|
||||
linktitle:
|
||||
description: Information on the Hugo license.
|
||||
date: 2016-02-01
|
||||
@@ -12,17 +12,17 @@ aliases: [/meta/license]
|
||||
notes:
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
Hugo v0.15 and later are released under the Apache 2.0 license.
|
||||
Earlier releases were under the Simple Public License.
|
||||
|
||||
## Apache License
|
||||
{{% /note %}}
|
||||
|
||||
_Version 2.0, January 2004_
|
||||
_<<http://www.apache.org/licenses/>>_
|
||||
|
||||
### Terms and Conditions for use, reproduction, and distribution
|
||||
## Terms and Conditions for use, reproduction, and distribution
|
||||
|
||||
#### 1. Definitions
|
||||
## 1. Definitions
|
||||
|
||||
“License” shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
@@ -76,7 +76,7 @@ owner as “Not a Contribution.”
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
#### 2. Grant of Copyright License
|
||||
## 2. Grant of Copyright License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
@@ -84,7 +84,7 @@ irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
#### 3. Grant of Patent License
|
||||
## 3. Grant of Patent License
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
@@ -99,7 +99,7 @@ Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
#### 4. Redistribution
|
||||
## 4. Redistribution
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
@@ -113,98 +113,50 @@ changed the files; and
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
#### 5. Submission of Contributions
|
||||
## 5. Submission of Contributions
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
#### 6. Trademarks
|
||||
## 6. Trademarks
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
#### 7. Disclaimer of Warranty
|
||||
## 7. Disclaimer of Warranty
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
#### 8. Limitation of Liability
|
||||
## 8. Limitation of Liability
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
#### 9. Accepting Warranty or Additional Liability
|
||||
## 9. Accepting Warranty or Additional Liability
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
_END OF TERMS AND CONDITIONS_
|
||||
|
||||
### APPENDIX: How to apply the Apache License to your work
|
||||
## APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets `[]` replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same “printed page” as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
{{% input "apache-notice.txt" %}}
|
||||
```
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
@@ -14,149 +14,163 @@ aliases: []
|
||||
notes:
|
||||
---
|
||||
|
||||
**Archetypes** are content (i.e., `.md`) files in the `archetypes` directory of your [project][] that contain pre-configured [front matter][] for your site's [content types][]. Archetypes facilitate more consistent metadata by enabling `hugo new` to populate new instances of a content type.
|
||||
**Archetypes** are content (i.e., `.md`) files in the [`archetypes` directory][] of your project that contain pre-configured [front matter][] for your site's [content types][]. Archetypes facilitate consistent metadata in your website's content and allow content authors to quickly generate instances of a content type via the `hugo new` command.
|
||||
|
||||
Hugo uses **archetypes** to facilitate creation of consistent metadata for content types across a website. Archetypes allow authors to easily generate new content files with associated metadata that are new instances of a content type. {{< relref "content-management/front-matter.md" >}}
|
||||
Hugo's generator 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:
|
||||
|
||||
To create new instances of a content type that pull from an archetype, authors can use the the `hugo new` command combined with the file path that assumes the present directory is [content][] downward; e.g.---
|
||||
```bash
|
||||
hugo new [content-section/file-name.md]
|
||||
```
|
||||
|
||||
We can use this pattern to create a new `.md` file in the `posts` section of the [example site][]:
|
||||
|
||||
{{% input "archetype-example.sh" %}}
|
||||
```bash
|
||||
hugo new posts/my-first-post.md
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
When defining a custom content type, you can use an **archetype** as a way to
|
||||
define the default metadata for a new post of that type.
|
||||
{{% note "Override the Inferred Content Type in a New File" %}}
|
||||
To override the content type Hugo infers from `[content-section]`, you can include the `--kind` flag at the end of the `hugo new` command.
|
||||
{{% /note %}}
|
||||
|
||||
If you were to run this command in a new site that does not contain any default or custom archetypes, Hugo will create the following file.
|
||||
|
||||
{{% output "content/posts/my-first-post.md" %}}
|
||||
```toml
|
||||
+++
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
title: my first post
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
|
||||
Note that if you do not already have a `posts` directory in `content`, Hugo will create both `content/posts/` and `content/posts/my-first-post.md`.
|
||||
|
||||
`date` and `title` are the key-values that ship with Hugo and are therefore included in *all* content files created with the Hugo CLI. `title` is generated from the new content's filename. `date` is generated in [RFC 3339 format][] by way of Golang's [`now()`][] function, which returns the current time.
|
||||
|
||||
Two key-values are often not enough for effective content management of larger websites. As such, Hugo provides a simple mechanism for extending these key-values through default and custom archetypes.
|
||||
|
||||
## Lookup Order for Archetypes
|
||||
|
||||
Similar to the lookup order for [templates in the layouts folder][], Hugo looks for a default file before falling back on the base/internal archetype. For the `my-first-post.md` example, Hugo looks for the new content's archetype file in the following order:
|
||||
|
||||
1. `archetypes/posts.md`
|
||||
2. `archetypes/default.md`
|
||||
3. `themes/theme-name/archetypes/posts.md`
|
||||
4. `themes/theme-name/archetypes/default.md`
|
||||
5. `_internal` (i.e., `title` and `date`)
|
||||
|
||||
{{% note "Using a Theme Archetype" %}}
|
||||
If you wish to use archetypes that ship with a theme, `theme` must be specified in your [configuration file](/project-organization/configuration/).
|
||||
{{% /note %}}
|
||||
|
||||
## Choosing Your Front Matter Format
|
||||
|
||||
By default, `hugo new` content files include front matter in the TOML format regardless of the format used in `archetypes/*md`.
|
||||
|
||||
You can specify a different default format in your site [configuration file][] file using the `metaDataFormat` directive. Possible values are `toml`, `yaml`, and `json`.
|
||||
|
||||
## Creating a Default Archetype
|
||||
|
||||
In the following example scenario, suppose we have a blog with a single content
|
||||
type (blog post). Our imaginary blog will use ‘tags’ and ‘categories’ for its
|
||||
taxonomies, so let's create an archetype file with ‘tags’ and ‘categories’
|
||||
predefined:
|
||||
Default archetypes are convenient if your content's front matter stays consistent across multiple [content sections][].
|
||||
|
||||
The [example site][] includes `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.
|
||||
|
||||
{{% input "archetypes/default.md" %}}
|
||||
```toml
|
||||
+++
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
tags = ["golang", "hugo"]
|
||||
categories = ["web development"]
|
||||
+++
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
{{% caution ""%}}
|
||||
Some editors (e.g., Sublime, Emacs) do not insert an end-of-line (EOL) character at the end of the file (EOF). If you get a [strange EOF error](/troubleshooting/frequently-asked-questions/#eof-error) when using `hugo new`, open each archetype file and press <kbd>Enter</kbd> to type a carriage return after the closing `+++` or `---` if you're using TOML or YAML front matter, respectively.
|
||||
{{% caution "EOL Characters in Text Editors"%}}
|
||||
Some editors (e.g., Sublime Text, Emacs) do not insert an end-of-line (EOL) character at the end of the file (EOF). If you get an [EOF error](/troubleshooting/eof-error/) when using `hugo new`, open each archetype file and press <kbd>Enter</kbd> to type a carriage return after the closing `+++` or `---` for your TOML or YAML front matter, respectively.
|
||||
{{% /caution %}}
|
||||
|
||||
## Using the Default Archetype
|
||||
|
||||
Now, with `archetypes/default.md` in place, let's create a new post in the `post` section with the `hugo new` command:
|
||||
With an `archetypes/default.md` in place, we can use the CLI to create a new post in the `posts` content section:
|
||||
|
||||
{{% input "new-post.sh" %}}
|
||||
{{% input "new-post-from-default-archetype.sh" %}}
|
||||
```bash
|
||||
$ hugo new post/my-new-post.md
|
||||
$ hugo new posts/my-new-post.md
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
Hugo will now create the file with the following contents:
|
||||
Hugo then creates a new markdown file with the following front matter:
|
||||
|
||||
{{% output "content/post/my-new-post.md" %}}
|
||||
{{% output "content/posts/my-new-post.md" %}}
|
||||
```toml
|
||||
+++
|
||||
categories = ["web development"]
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
tags = ["golang", "hugo"]
|
||||
title = "my new post"
|
||||
date = "2015-01-12T19:20:04-07:00"
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
|
||||
We see that the `title` and `date` variables have been added in addition to the `tags` and `categories` variables that were carried over from `archetype/default.md`.
|
||||
We see that the `title` and `date` key-values have been added in addition to the `tags` and `categories` key-values from `archetypes/default.md`.
|
||||
|
||||
Congratulations! We have successfully created an archetype and used it to
|
||||
quickly scaffold out a new post. But wait, what if we want to create some content that isn't exactly a blog post, like a profile for a musician? Let's see how using **archetypes** can help us out.
|
||||
|
||||
### Override the Inferred Content Type in a New File
|
||||
|
||||
To override the content type for a new post, include the `--kind` flag during creation.
|
||||
|
||||
{{% note "Using a Theme Archetype" %}}
|
||||
If you wish to use archetypes that ship with a theme, the theme must be specified in your [configuration file](/project-organization/configuration/).
|
||||
{{% note "Ordering of Front Matter" %}}
|
||||
You may notice that content files created with `hugo new` do not observe the order of the key-values specified in your archetype files and instead list your front matter alphabetically. This is a known issue ({{< issue 452 >}}).
|
||||
{{% /note %}}
|
||||
|
||||
## Creating Custom Archetypes
|
||||
|
||||
Previously, we had created a new content type by adding a new subfolder to the content directory. In this case, its name would be `content/musician`. To begin using a `musician` archetype for each new `musician` post, we simply need to create a file named after the content type called `musician.md`, and put it in the `archetypes` directory, similar to the one below.
|
||||
Suppose the example site's `posts` section requires more sophisticated front matter than what has been specified in `archetypes/default.md`. We can create a custom archetype for our posts at `archetypes/posts.md` that includes the full set of front matter.
|
||||
|
||||
{{% input "archetypes/musician.md"%}}
|
||||
{{% input "archetypes/posts.md"%}}
|
||||
```toml
|
||||
+++
|
||||
name = ""
|
||||
bio = ""
|
||||
genre = ""
|
||||
subtitle = ""
|
||||
author = ""
|
||||
publishdate = ""
|
||||
description = ""
|
||||
tags = ""
|
||||
categories = ""
|
||||
+++
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
Now, let's create a new musician.
|
||||
## Using Custom Archetypes
|
||||
|
||||
{{% input "new-musician.sh" %}}
|
||||
With an `archetypes/posts.md` in place, we can use the CLI to create a new posts with custom `posts` metadata in the `posts` content section:
|
||||
|
||||
{{% input "new-post-from-custom-archetype.sh" %}}
|
||||
```bash
|
||||
$ hugo new musician/mozart.md
|
||||
$ hugo new posts/post-from-custom.md
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
This time, Hugo recognizes our custom `musician` archetype and uses it instead of the default one. Take a look at the new `musician/mozart.md` post. You should see that the generated file's front matter now includes the variables `name`, `bio`, and `genre`.
|
||||
|
||||
|
||||
{{% output "content/musician/mozart.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 archetypes `title` and `date`.
|
||||
|
||||
{{% output "content/posts/post-from-custom.md" %}}
|
||||
```toml
|
||||
+++
|
||||
title = "mozart"
|
||||
date = "2015-08-24T13:04:37+02:00"
|
||||
name = ""
|
||||
bio = ""
|
||||
genre = ""
|
||||
author = ""
|
||||
categories = ""
|
||||
date = 2017-02-13T17:24:43-08:00
|
||||
description = ""
|
||||
publishdate = ""
|
||||
subtitle = ""
|
||||
tags = ""
|
||||
title = post from custom
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
|
||||
## Using a Different Front Matter Format
|
||||
|
||||
By default, the front matter will be created in the TOML format regardless of what format the archetype is using.
|
||||
|
||||
You can specify a different default format in your site [configuration file][] file using the `metaDataFormat` directive. Possible values are `toml`, `yaml`, and `json`.
|
||||
|
||||
## Which Archetype is Being Used
|
||||
|
||||
The following rules apply when creating new content:
|
||||
|
||||
* If an archetype with a filename matching the new post's [content type](/content/content-types) exists, it will be used.
|
||||
* If no match is found, `archetypes/default.md` will be used.
|
||||
* If neither is present and a theme is in use, then within the theme:
|
||||
* If an archetype with a filename that matches the content type being created, it will be used.
|
||||
* If no match is found, `archetypes/default.md` will be used.
|
||||
* If no archetype files are present, then the one that ships with Hugo will be used.
|
||||
|
||||
Hugo provides a simple archetype which sets the `title` (based on the
|
||||
file name) and the `date` in [RFC 3339 format][] based on [`now()`][], which returns the current time.
|
||||
|
||||
{{% note "Dynamic Key-Values in Archetypes" %}}
|
||||
`hugo new` does *not* automatically add `draft = true` when the user
|
||||
provides an archetype. This is by design---the rationale is that the archetype should set its own value for all fields. `title` and `date`, which are dynamic and unique for each piece of content, are the sole exceptions.
|
||||
{{% /note %}}
|
||||
|
||||
The content type is automatically detected based on the file path passed to the
|
||||
Hugo CLI command:
|
||||
|
||||
```bash
|
||||
hugo new [my-content-type/post-name]
|
||||
```
|
||||
|
||||
[`archetypes` directory]: /project-organization/directory-structure/
|
||||
[`now()`]: http://golang.org/pkg/time/#Now
|
||||
[configuration file]: /project-organization/configuration/
|
||||
[content]: /project-organization/directory-structure/
|
||||
[content sections]: /content-sections/
|
||||
[content types]: /content-management/content-types/
|
||||
[example site]: /getting-started/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[project]:
|
||||
[RFC 3339 format]: https://www.ietf.org/rfc/rfc3339.txt
|
||||
|
||||
[taxonomies]: /content-management/taxonomies/
|
||||
[templates in the layouts folder]: /templates/base-templates-and-blocks/
|
||||
[templates]: /templates/
|
||||
|
||||
@@ -7,7 +7,7 @@ publishdate: 2017-01-10
|
||||
lastmod: 2017-01-10
|
||||
tags: []
|
||||
categories: []
|
||||
weight: 60
|
||||
weight: 70
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
|
||||
@@ -7,7 +7,7 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-01-09
|
||||
categories: [content]
|
||||
tags: [cross references, anchors]
|
||||
weight: 70
|
||||
weight: 80
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
title: Front Matter
|
||||
linktitle:
|
||||
description: Hugo allows you to add front matter in yaml, toml, or json to you content/markdown files.
|
||||
description: Hugo allows you to add front matter in yaml, toml, or json to your content files.
|
||||
date: 2017-01-09
|
||||
publishdate: 2017-01-09
|
||||
lastmod: 2017-01-09
|
||||
categories: [content]
|
||||
tags: [front matter, yaml, toml, json, metadata]
|
||||
tags: [front matter, yaml, toml, json, metadata, archetypes]
|
||||
weight: 20
|
||||
draft: false
|
||||
slug:
|
||||
|
||||
@@ -7,7 +7,7 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [aliases,redirects,permalinks, url management,urls]
|
||||
categories: [content management]
|
||||
weight: 80
|
||||
weight: 90
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
|
||||
@@ -7,7 +7,7 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: []
|
||||
weight: 100
|
||||
weight: 110
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
|
||||
@@ -7,7 +7,7 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: []
|
||||
weight: 90
|
||||
weight: 100
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Taxonomies
|
||||
linktitle:
|
||||
description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [taxonomies,terms]
|
||||
categories: [content]
|
||||
weight: 60
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
@@ -11,4 +11,8 @@ draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
---
|
||||
|
||||
## Generators
|
||||
|
||||
## Flags
|
||||
@@ -13,4 +13,4 @@ aliases:
|
||||
notes:
|
||||
---
|
||||
|
||||
## List Page Lookup Order
|
||||
## Lookup Order for List and Section Pages
|
||||
@@ -11,4 +11,6 @@ draft: false
|
||||
slug:
|
||||
aliases:
|
||||
notes:
|
||||
---
|
||||
---
|
||||
|
||||
## Lookup Order for Single Page Templates
|
||||
@@ -6,7 +6,7 @@ date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
weight:
|
||||
tags: []
|
||||
tags: [taxonomies]
|
||||
draft: false
|
||||
slug:
|
||||
aliases:
|
||||
|
||||
@@ -5,7 +5,6 @@ description: Frequently asked questions and known issues pulled from the Hugo Di
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
layout: sectionlist
|
||||
weight:
|
||||
draft: false
|
||||
slug:
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: EOF Error
|
||||
linktitle:
|
||||
description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [EOF, end of file, error, faqs]
|
||||
categories: [troubleshooting]
|
||||
weight:
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
publishdate: Now()
|
||||
expirydate: ""
|
||||
description: ""
|
||||
tags: [tag1, tag2]
|
||||
categories: ['base category']
|
||||
---
|
||||
+++
|
||||
subtitle = ""
|
||||
author = ""
|
||||
publishdate = ""
|
||||
description = ""
|
||||
tags = ""
|
||||
categories = ""
|
||||
+++
|
||||
@@ -30,5 +30,6 @@
|
||||
<div class="body-copy">
|
||||
{{.Content}}
|
||||
</div>
|
||||
{{partial "table-of-contents.html" . }}
|
||||
</main>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{ if gt .WordCount 500}}
|
||||
<aside id="toc">
|
||||
<header>
|
||||
<h3>{{.Title}}</h3>
|
||||
</header>
|
||||
{{.TableOfContents}}
|
||||
<a href="#" id="toc-toggle">ToC</a>
|
||||
</aside>
|
||||
{{ end }}
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="caution">
|
||||
<h2><i class="icon-caution"></i> {{if .Get 0}}{{.Get 0}}{{else}}Caution{{end}}</h2>
|
||||
<h2><i class="icon-caution"></i> {{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Caution{{end}}</h2>
|
||||
<div class="shortcode-content">
|
||||
{{.Inner}}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<a class="issue-link" href="{{.Site.Params.ghrepo}}issues/{{.Get 0}}">#{{.Get 0}}</a>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="note">
|
||||
<h2><i class="icon-note"></i> {{if .Get 0}}{{.Get 0}}{{else}}Note{{end}}</h2>
|
||||
<h2><i class="icon-note"></i> {{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Note{{end}}</h2>
|
||||
<div class="shortcode-content">
|
||||
{{.Inner}}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="warning">
|
||||
<h2><i class="icon-warning"></i> {{if .Get 0}}{{.Get 0}}{{else}}Warning{{end}}</h2>
|
||||
<h2><i class="icon-warning"></i> {{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Warning{{end}}</h2>
|
||||
<div class="shortcode-content">
|
||||
{{.Inner}}
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ $('.body-copy > h2,.body-copy > h3').each(function() {
|
||||
|
||||
$(document).ready(function () {
|
||||
// bind click event to all internal page anchors
|
||||
$('a.heading-link').on('click', function (e) {
|
||||
$('a.heading-link,#TableOfContents a').on('click', function (e) {
|
||||
// prevent default action and bubbling
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -57,11 +57,11 @@ $code-copy-button-color:#ffffff;
|
||||
$code-copy-button-text-color:$base-font-color;
|
||||
$code-base-font-color:$hugo-pink-light;
|
||||
$inline-code-text-color:$base-font-color;
|
||||
$inline-code-background-color:lighten($hugo-gray-light,15%);
|
||||
$inline-code-background-color:lighten($hugo-gray-light,21%);
|
||||
|
||||
//Sidebar
|
||||
$site-navigation-width: 280px;
|
||||
$content-max-width: 35em;
|
||||
$content-max-width: 31em;
|
||||
|
||||
//Header
|
||||
$site-header-height:50px;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
aside#toc {
|
||||
position: fixed;
|
||||
max-width: 300px;
|
||||
min-width:200px;
|
||||
overflow-y:scroll;
|
||||
nav {
|
||||
float:left;
|
||||
ul {
|
||||
margin-top: .5em;
|
||||
}
|
||||
ul li ul {
|
||||
font-size: .9em;
|
||||
li {
|
||||
a {
|
||||
color: lighten($base-font-color, 25%);
|
||||
}
|
||||
ul {
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
h3 {
|
||||
margin-bottom: 0px;
|
||||
padding-bottom: 0px;
|
||||
border-bottom: 1px solid $base-font-color;
|
||||
}
|
||||
@include MQ(XL) {
|
||||
top: $site-header-height + 20px;
|
||||
right: 3vw;
|
||||
}
|
||||
}
|
||||
|
||||
a#toc-toggle {
|
||||
@include MQ(XL) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ main.main {
|
||||
position: relative;
|
||||
min-height:calc(100vh - #{$site-header-height * 2});
|
||||
overflow-x: hidden;
|
||||
@include MQ(L){
|
||||
margin-left:1em;
|
||||
}
|
||||
}
|
||||
|
||||
header.content-header {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
&.active-section {
|
||||
color: $active-color;
|
||||
// border-bottom: 1px solid $active-color;
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
+ ul.submenu {
|
||||
display: block;
|
||||
border-left: 1px solid $hugo-pink;
|
||||
@@ -59,7 +59,7 @@
|
||||
color: lighten($base-font-color, 25%);
|
||||
}
|
||||
&.active-page {
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
color: $hugo-blue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ main#homepage {
|
||||
max-width: $M * .9;
|
||||
}
|
||||
@include MQ(L) {
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
max-width: 860px * .9;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
@import 'algolia/main';
|
||||
@import 'components/site-search';
|
||||
@import 'components/keyboard';
|
||||
@import 'components/table-of-contents';
|
||||
|
||||
|
||||
//major layout parts/chrome
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
||||
languageCode = "en-us"
|
||||
title = "My New Hugo Site"
|
||||
baseURL = "http://example.org/"
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user