Add first exFile shortcode

This commit is contained in:
Ryan Watters 2017-02-17 13:14:55 -06:00
parent 9d68eb723c
commit bf7399fe2f
608 changed files with 131 additions and 59 deletions

View File

@ -75,11 +75,10 @@ watch = true
removefromexternalsearch = true
## This is used when the BaseURL does not need to modified (eg, in share links)
siteaddress = "https://gohugo.io"
## Gh repo for site footer
## Gh repo for site footer (include trailing slash)
ghrepo = "https://github.com/spf13/hugo/"
## GitHub Docs Repository Base URL (include trailing slash)
# ghdocsrepo = "https://github.com/rdwatters/hugo-docs-concept/"
ghdocsrepo = ""
ghdocsrepo = "https://github.com/rdwatters/hugo-docs-concept/"
## Github Wiki for Documentation
ghdocswiki = ""
## Github Wiki for Development

View File

@ -1,6 +1,6 @@
---
title: Archetypes
linktitle:
linktitle: Archetypes
description: Archetypes allow you to create and set default parameters from the command line according to the content section.
date: 2017-02-01
publishdate: 2017-02-01
@ -73,10 +73,12 @@ By default, `hugo new` content files include front matter in the TOML format reg
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
## Default Archetypes
Default archetypes are convenient if your content's front matter stays consistent across multiple [content sections][].
### Creating the Default Archetype
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" %}}
@ -92,7 +94,7 @@ categories = ["web development"]
If you get an `EOF error` when using `hugo new`, add a carriage return after the closing `+++` or `---` for your TOML or YAML front matter, respectively. (See [troubleshooting](/troubleshooting/eof-error/).)
{{% /caution %}}
## Using the Default Archetype
### Using the Default Archetype
With an `archetypes/default.md` in place, we can use the CLI to create a new post in the `posts` content section:
@ -118,19 +120,24 @@ title = "my new post"
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`.
{{% 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 >}}).
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 ({{< gh 452 >}}).
{{% /note %}}
## Creating Custom Archetypes
### Example Site Default Archetype
The following is the default archetype used in the [example site][].
{{< exfile "static/example/archetypes/default.md" "yaml">}}
## Custom Archetypes
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.
### Creating a Custom Archetype
{{% input "archetypes/posts.md"%}}
```toml
+++
subtitle = ""
author = ""
publishdate = ""
description = ""
tags = ""
categories = ""
@ -138,7 +145,7 @@ categories = ""
```
{{% /input %}}
## Using Custom Archetypes
### Using a Custom Archetype
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:
@ -153,24 +160,30 @@ This time, Hugo recognizes our custom `archetypes/posts.md` archetype and uses i
{{% output "content/posts/post-from-custom.md" %}}
```toml
+++
author = ""
categories = ""
date = 2017-02-13T17:24:43-08:00
description = ""
publishdate = ""
subtitle = ""
tags = ""
title = post from custom
+++
```
{{% /output %}}
### Example Site Custom Archetype
`musicians` in the [example site] require more sophisticated front matter than what has been specified in `archetypes/default.md`. We can create a custom archetype for musicians at `archetypes/musicians.md` that includes the full set of front matter.
The following is the `musicians` archetype from the [example site][]:
{{< exfile "static/example/archetypes/musicians.md" "yaml" >}}
[archetypes directory]: /project-organization/directory-structure/
[`now()`]: http://golang.org/pkg/time/#Now
[configuration file]: /project-organization/configuration/
[content sections]: /content-sections/
[content types]: /content-management/content-types/
[example site]: /getting-started/
[example site]: /getting-started/using-the-hugo-docs/#example-site
[front matter]: /content-management/front-matter/
[RFC 3339 format]: https://www.ietf.org/rfc/rfc3339.txt
[taxonomies]: /content-management/taxonomies/

View File

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [contribute to hugo]
tags: [docs,documentation]
tags: [docs,documentation,community]
weight:
draft: false
slug:

View File

@ -6,8 +6,8 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [getting started]
tags: []
weight:
tags: [quick start,usage]
weight: 20
draft: false
slug:
aliases: []

View File

@ -0,0 +1,23 @@
---
title: Using the Hugo Docs
linktitle: Using the Hugo Docs
description:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [getting started]
tags: []
weight: 10
draft: false
slug:
aliases: [/getting-started/using-the-docs/]
toc: false
notes:
---
## Example Site
## Reading the Code Samples
## Contribute to the Docs

View File

@ -0,0 +1,12 @@
{{ $file := .Get 0}}
{{ $filepath := replace $file "static/example" ""}}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
<a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" class="see-on-github">See on <i class="icon-github"></i></a>
</div>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
---
publishdate: ""
description: ""
musician: ""
---

View File

@ -0,0 +1,12 @@
---
namefirst: ""
namelast: ""
nickname: ""
tags: []
categories: []
instruments: []
genres: []
birthyear: ""
death: ""
---

View File

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 357 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Some files were not shown because too many files have changed in this diff Show More