mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-17 17:21:02 -04:00
Update incorrect titles in example front matter
Closes rdwatters/hugo-docs-concept#83
This commit is contained in:
parent
b50796e3ac
commit
2ea0e17bed
@ -168,7 +168,7 @@ categories = ""
|
||||
date = 2017-02-13T17:24:43-08:00
|
||||
description = ""
|
||||
tags = ""
|
||||
title = post from custom archetype
|
||||
title = "post from custom archetype"
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
|
@ -73,6 +73,14 @@ A relative document name must *not* begin with a slash (`/`).
|
||||
{{</* relref "/events/my-birthday.md" */>}} => ""
|
||||
```
|
||||
|
||||
### With Multiple Output Formats
|
||||
|
||||
If the page exists in multiple [output formats][], `ref` or `relref` can be used with a output format name:
|
||||
|
||||
```
|
||||
[Neat]({{</* ref "blog/neat.md" "amp" */>}})
|
||||
```
|
||||
|
||||
### Anchors
|
||||
|
||||
When an `anchor` is provided by itself, the current page’s unique identifier will be appended; when an `anchor` is provided appended to `documentname`, the found page's unique identifier will be appended:
|
||||
|
@ -108,6 +108,9 @@ The following is the full list of configuration options for output formats and t
|
||||
`NoUgly`
|
||||
: Used to turn off ugly URLs If `uglyURLs` is set to `true` in your site. **Default:** `false`.
|
||||
|
||||
`NotAlternative`
|
||||
: Enable if it doesn't make sense to include this format in an `AlternativeOutputFormats` format listing on `Page` (e.g., with `CSS`). Note that we use the term *alternative* and not *alternate* here, as it does not necessarily replace the other format. **Default:** `false`.
|
||||
|
||||
|
||||
## Output Formats for your pages
|
||||
|
||||
@ -151,6 +154,33 @@ outputs:
|
||||
---
|
||||
```
|
||||
|
||||
## Linking to Output Formats
|
||||
|
||||
+ `Page` has both `.OutputFormats` (all formats including the current) and `.AlternativeOutputFormats`, the latter useful for creating a `link rel` list in your `head` section:
|
||||
|
||||
```
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
|
||||
{{ end -}}
|
||||
```
|
||||
|
||||
Note that `.Permalink` on `RelPermalink` on `Page` will return the first output format defined for that page (usually `HTML` if nothing else is defined).
|
||||
|
||||
This is how you link to a given output format:
|
||||
|
||||
```
|
||||
{{ with .OutputFormats.Get "json" -}}
|
||||
<a href="{{ .Permalink }}">{{ .Name }}</a>
|
||||
{{- end }}
|
||||
```
|
||||
|
||||
From content files, you can use the [`ref` or `relref` shortcodes](/content-management/shortcodes/#ref-and-relref):
|
||||
|
||||
```
|
||||
[Neat]({{</* ref "blog/neat.md" "amp" */>}})
|
||||
[Who]({{</* relref "about.md#who" "amp" */>}})
|
||||
```
|
||||
|
||||
## Templates for Your Output Formats
|
||||
|
||||
A new output format needs needs a corresponding template in order to render anything useful.
|
||||
@ -170,7 +200,11 @@ And with so many possible variations, this is best explained with some examples:
|
||||
|
||||
Hugo will now also detect the media type and output format of partials, if possible, and use that information to decide if the partial should be parsed as a plain text template or not.
|
||||
|
||||
Hugo will look for the name given, so you can name it whatever you want. But if you want it treated as plain text, you should use the file suffix and, if needed, the name of the Output Format (`[partial name].[OutputFormat].[suffix])`.
|
||||
Hugo will look for the name given, so you can name it whatever you want. But if you want it treated as plain text, you should use the file suffix and, if needed, the name of the Output Format. The pattern is as follows:
|
||||
|
||||
```
|
||||
[partial name].[OutputFormat].[suffix]
|
||||
```
|
||||
|
||||
The partial below is a plain text template (Outpuf Format is `CSV`, and since this is the only output format with the suffix `csv`, we don't need to include the Output Format's `Name`):
|
||||
|
||||
|
@ -46,7 +46,7 @@ The following examples take you stepwise through creating a new type layout for
|
||||
{{% code file="content/events/my-first-event.md" copy="false" %}}
|
||||
```toml
|
||||
+++
|
||||
title: My First Event
|
||||
title = My First Event
|
||||
date = "2016-06-24T19:20:04-07:00"
|
||||
description = "Today is my 36th birthday. My how time flies."
|
||||
type = "event"
|
||||
|
@ -6,6 +6,7 @@ publishdate: ""
|
||||
lastmod: ""
|
||||
categories: [functions]
|
||||
tags: []
|
||||
ns: ""
|
||||
signature: []
|
||||
workson: []
|
||||
hugoversion: ""
|
||||
|
@ -2,55 +2,55 @@
|
||||
"media": {
|
||||
"types": [{
|
||||
"Type": "application/javascript",
|
||||
"String": "application/javascriptjs",
|
||||
"String": "application/javascript+js",
|
||||
"MainType": "application",
|
||||
"SubType": "javascript",
|
||||
"Suffix": "js"
|
||||
}, {
|
||||
"Type": "application/json",
|
||||
"String": "application/jsonjson",
|
||||
"String": "application/json+json",
|
||||
"MainType": "application",
|
||||
"SubType": "json",
|
||||
"Suffix": "json"
|
||||
}, {
|
||||
"Type": "application/rss",
|
||||
"String": "application/rssxml",
|
||||
"String": "application/rss+xml",
|
||||
"MainType": "application",
|
||||
"SubType": "rss",
|
||||
"Suffix": "xml"
|
||||
}, {
|
||||
"Type": "application/xml",
|
||||
"String": "application/xmlxml",
|
||||
"String": "application/xml+xml",
|
||||
"MainType": "application",
|
||||
"SubType": "xml",
|
||||
"Suffix": "xml"
|
||||
}, {
|
||||
"Type": "text/calendar",
|
||||
"String": "text/calendarics",
|
||||
"String": "text/calendar+ics",
|
||||
"MainType": "text",
|
||||
"SubType": "calendar",
|
||||
"Suffix": "ics"
|
||||
}, {
|
||||
"Type": "text/css",
|
||||
"String": "text/csscss",
|
||||
"String": "text/css+css",
|
||||
"MainType": "text",
|
||||
"SubType": "css",
|
||||
"Suffix": "css"
|
||||
}, {
|
||||
"Type": "text/csv",
|
||||
"String": "text/csvcsv",
|
||||
"String": "text/csv+csv",
|
||||
"MainType": "text",
|
||||
"SubType": "csv",
|
||||
"Suffix": "csv"
|
||||
}, {
|
||||
"Type": "text/html",
|
||||
"String": "text/htmlhtml",
|
||||
"String": "text/html+html",
|
||||
"MainType": "text",
|
||||
"SubType": "html",
|
||||
"Suffix": "html"
|
||||
}, {
|
||||
"Type": "text/plain",
|
||||
"String": "text/plaintxt",
|
||||
"String": "text/plain+txt",
|
||||
"MainType": "text",
|
||||
"SubType": "plain",
|
||||
"Suffix": "txt"
|
||||
@ -58,7 +58,7 @@
|
||||
},
|
||||
"output": {
|
||||
"formats": [{
|
||||
"MediaType": "text/htmlhtml",
|
||||
"MediaType": "text/html+html",
|
||||
"Name": "AMP",
|
||||
"Path": "amp",
|
||||
"BaseName": "index",
|
||||
@ -66,9 +66,10 @@
|
||||
"Protocol": "",
|
||||
"IsPlainText": false,
|
||||
"IsHTML": true,
|
||||
"NoUgly": false
|
||||
"NoUgly": false,
|
||||
"NotAlternative": false
|
||||
}, {
|
||||
"MediaType": "text/csscss",
|
||||
"MediaType": "text/css+css",
|
||||
"Name": "CSS",
|
||||
"Path": "",
|
||||
"BaseName": "styles",
|
||||
@ -76,9 +77,10 @@
|
||||
"Protocol": "",
|
||||
"IsPlainText": true,
|
||||
"IsHTML": false,
|
||||
"NoUgly": false
|
||||
"NoUgly": false,
|
||||
"NotAlternative": true
|
||||
}, {
|
||||
"MediaType": "text/csvcsv",
|
||||
"MediaType": "text/csv+csv",
|
||||
"Name": "CSV",
|
||||
"Path": "",
|
||||
"BaseName": "index",
|
||||
@ -86,9 +88,10 @@
|
||||
"Protocol": "",
|
||||
"IsPlainText": true,
|
||||
"IsHTML": false,
|
||||
"NoUgly": false
|
||||
"NoUgly": false,
|
||||
"NotAlternative": false
|
||||
}, {
|
||||
"MediaType": "text/calendarics",
|
||||
"MediaType": "text/calendar+ics",
|
||||
"Name": "Calendar",
|
||||
"Path": "",
|
||||
"BaseName": "index",
|
||||
@ -96,9 +99,10 @@
|
||||
"Protocol": "webcal://",
|
||||
"IsPlainText": true,
|
||||
"IsHTML": false,
|
||||
"NoUgly": false
|
||||
"NoUgly": false,
|
||||
"NotAlternative": false
|
||||
}, {
|
||||
"MediaType": "text/htmlhtml",
|
||||
"MediaType": "text/html+html",
|
||||
"Name": "HTML",
|
||||
"Path": "",
|
||||
"BaseName": "index",
|
||||
@ -106,9 +110,10 @@
|
||||
"Protocol": "",
|
||||
"IsPlainText": false,
|
||||
"IsHTML": true,
|
||||
"NoUgly": false
|
||||
"NoUgly": false,
|
||||
"NotAlternative": false
|
||||
}, {
|
||||
"MediaType": "application/jsonjson",
|
||||
"MediaType": "application/json+json",
|
||||
"Name": "JSON",
|
||||
"Path": "",
|
||||
"BaseName": "index",
|
||||
@ -116,9 +121,10 @@
|
||||
"Protocol": "",
|
||||
"IsPlainText": true,
|
||||
"IsHTML": false,
|
||||
"NoUgly": false
|
||||
"NoUgly": false,
|
||||
"NotAlternative": false
|
||||
}, {
|
||||
"MediaType": "application/rssxml",
|
||||
"MediaType": "application/rss+xml",
|
||||
"Name": "RSS",
|
||||
"Path": "",
|
||||
"BaseName": "index",
|
||||
@ -126,7 +132,8 @@
|
||||
"Protocol": "",
|
||||
"IsPlainText": false,
|
||||
"IsHTML": false,
|
||||
"NoUgly": true
|
||||
"NoUgly": true,
|
||||
"NotAlternative": false
|
||||
}],
|
||||
"layouts": [{
|
||||
"Example": "AMP home, with theme \"demoTheme\".",
|
||||
|
Loading…
x
Reference in New Issue
Block a user