camelCase output format options

Fixes #114
This commit is contained in:
Bjørn Erik Pedersen committed 2017-07-31 16:56:51 +02:00
1 parent 902a14a185
commit 00f39bd78d
2 files changed
+185 -129

No files matched your search

+12 -12
View File
@@ -26,7 +26,7 @@ A [media type][] (also known as *MIME type* and *content type*) is a two-part id
This is the full set of built-in media types in Hugo: This is the full set of built-in media types in Hugo:
{{< datatable "media" "types" "Type" "Suffix" >}} {{< datatable "media" "types" "type" "suffix" >}}
**Note:** **Note:**
@@ -55,7 +55,7 @@ Given a media type and some additional configuration, you get an `Output Format`
This is the full set of Hugo's built-in output formats: This is the full set of Hugo's built-in output formats:
{{< datatable "output" "formats" "Name" "MediaType" "Path" "BaseName" "Rel" "Protocol" "IsPlainText" "IsHTML" "NoUgly">}} {{< datatable "output" "formats" "name" "mediaType" "path" "baseName" "rel" "protocol" "isPlainText" "isHTML" "noUgly">}}
* A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `AMP` vs. `HTML`. `AMP` has the value `amp` for `Path` so it doesn't overwrite the `HTML` version; e.g. we can now have both `/index.html` and `/amp/index.html`. * A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `AMP` vs. `HTML`. `AMP` has the value `amp` for `Path` so it doesn't overwrite the `HTML` version; e.g. we can now have both `/index.html` and `/amp/index.html`.
* The `MediaType` must match the `Type` of an already defined media type. * The `MediaType` must match the `Type` of an already defined media type.
@@ -77,34 +77,34 @@ The above example is fictional, but if used for the homepage on a site with `bas
The following is the full list of configuration options for output formats and their default values: The following is the full list of configuration options for output formats and their default values:
`Name` `name`
: the output format identifier. This is used to define what output format(s) you want for your pages. : the output format identifier. This is used to define what output format(s) you want for your pages.
`MediaType` `mediaType`
: this must match the `Type` of a defined media type. : this must match the `Type` of a defined media type.
`Path` `path`
: sub path to save the output files. : sub path to save the output files.
`BaseName` `baseName`
: the base filename for the list filenames (homepage, etc.). **Default:** `index`. : the base filename for the list filenames (homepage, etc.). **Default:** `index`.
`Rel` `rel`
: can be used to create `rel` values in `link` tags. **Default:** `alternate`. : can be used to create `rel` values in `link` tags. **Default:** `alternate`.
`Protocol` `protocol`
: will replace the "http://" or "https://" in your `baseURL` for this output format. : will replace the "http://" or "https://" in your `baseURL` for this output format.
`IsPlainText` `isPlainText`
: use Go's plain text templates parser for the templates. **Default:** `false`. : use Go's plain text templates parser for the templates. **Default:** `false`.
`IsHTML` `isHTML`
: used in situations only relevant for `HTML`-type formats; e.g., page aliases. : used in situations only relevant for `HTML`-type formats; e.g., page aliases.
`NoUgly` `noUgly`
: used to turn off ugly URLs If `uglyURLs` is set to `true` in your site. **Default:** `false`. : used to turn off ugly URLs If `uglyURLs` is set to `true` in your site. **Default:** `false`.
`NotAlternative` `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`. : 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 Pages ## Output Formats for Pages
+173 -117
View File
@@ -2,76 +2,76 @@
"media": { "media": {
"types": [ "types": [
{ {
"Type": "application/javascript", "type": "application/javascript",
"String": "application/javascript+js", "string": "application/javascript+js",
"MainType": "application", "mainType": "application",
"SubType": "javascript", "subType": "javascript",
"Suffix": "js", "suffix": "js",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "application/json", "type": "application/json",
"String": "application/json+json", "string": "application/json+json",
"MainType": "application", "mainType": "application",
"SubType": "json", "subType": "json",
"Suffix": "json", "suffix": "json",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "application/rss", "type": "application/rss",
"String": "application/rss+xml", "string": "application/rss+xml",
"MainType": "application", "mainType": "application",
"SubType": "rss", "subType": "rss",
"Suffix": "xml", "suffix": "xml",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "application/xml", "type": "application/xml",
"String": "application/xml+xml", "string": "application/xml+xml",
"MainType": "application", "mainType": "application",
"SubType": "xml", "subType": "xml",
"Suffix": "xml", "suffix": "xml",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/calendar", "type": "text/calendar",
"String": "text/calendar+ics", "string": "text/calendar+ics",
"MainType": "text", "mainType": "text",
"SubType": "calendar", "subType": "calendar",
"Suffix": "ics", "suffix": "ics",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/css", "type": "text/css",
"String": "text/css+css", "string": "text/css+css",
"MainType": "text", "mainType": "text",
"SubType": "css", "subType": "css",
"Suffix": "css", "suffix": "css",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/csv", "type": "text/csv",
"String": "text/csv+csv", "string": "text/csv+csv",
"MainType": "text", "mainType": "text",
"SubType": "csv", "subType": "csv",
"Suffix": "csv", "suffix": "csv",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/html", "type": "text/html",
"String": "text/html+html", "string": "text/html+html",
"MainType": "text", "mainType": "text",
"SubType": "html", "subType": "html",
"Suffix": "html", "suffix": "html",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/plain", "type": "text/plain",
"String": "text/plain+txt", "string": "text/plain+txt",
"MainType": "text", "mainType": "text",
"SubType": "plain", "subType": "plain",
"Suffix": "txt", "suffix": "txt",
"Delimiter": "." "delimiter": "."
} }
] ]
}, },
@@ -79,87 +79,143 @@
"formats": [ "formats": [
{ {
"MediaType": "text/html+html", "MediaType": "text/html+html",
"Name": "AMP", "name": "AMP",
"Path": "amp", "mediaType": {
"BaseName": "index", "type": "text/html",
"Rel": "amphtml", "string": "text/html+html",
"Protocol": "", "mainType": "text",
"IsPlainText": false, "subType": "html",
"IsHTML": true, "suffix": "html",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "amp",
"baseName": "index",
"rel": "amphtml",
"protocol": "",
"isPlainText": false,
"isHTML": true,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "text/css+css", "MediaType": "text/css+css",
"Name": "CSS", "name": "CSS",
"Path": "", "mediaType": {
"BaseName": "styles", "type": "text/css",
"Rel": "stylesheet", "string": "text/css+css",
"Protocol": "", "mainType": "text",
"IsPlainText": true, "subType": "css",
"IsHTML": false, "suffix": "css",
"NoUgly": false, "delimiter": "."
"NotAlternative": true },
"path": "",
"baseName": "styles",
"rel": "stylesheet",
"protocol": "",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": true
}, },
{ {
"MediaType": "text/csv+csv", "MediaType": "text/csv+csv",
"Name": "CSV", "name": "CSV",
"Path": "", "mediaType": {
"BaseName": "index", "type": "text/csv",
"Rel": "alternate", "string": "text/csv+csv",
"Protocol": "", "mainType": "text",
"IsPlainText": true, "subType": "csv",
"IsHTML": false, "suffix": "csv",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "text/calendar+ics", "MediaType": "text/calendar+ics",
"Name": "Calendar", "name": "Calendar",
"Path": "", "mediaType": {
"BaseName": "index", "type": "text/calendar",
"Rel": "alternate", "string": "text/calendar+ics",
"Protocol": "webcal://", "mainType": "text",
"IsPlainText": true, "subType": "calendar",
"IsHTML": false, "suffix": "ics",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "webcal://",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "text/html+html", "MediaType": "text/html+html",
"Name": "HTML", "name": "HTML",
"Path": "", "mediaType": {
"BaseName": "index", "type": "text/html",
"Rel": "canonical", "string": "text/html+html",
"Protocol": "", "mainType": "text",
"IsPlainText": false, "subType": "html",
"IsHTML": true, "suffix": "html",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "canonical",
"protocol": "",
"isPlainText": false,
"isHTML": true,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "application/json+json", "MediaType": "application/json+json",
"Name": "JSON", "name": "JSON",
"Path": "", "mediaType": {
"BaseName": "index", "type": "application/json",
"Rel": "alternate", "string": "application/json+json",
"Protocol": "", "mainType": "application",
"IsPlainText": true, "subType": "json",
"IsHTML": false, "suffix": "json",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "application/rss+xml", "MediaType": "application/rss+xml",
"Name": "RSS", "name": "RSS",
"Path": "", "mediaType": {
"BaseName": "index", "type": "application/rss",
"Rel": "alternate", "string": "application/rss+xml",
"Protocol": "", "mainType": "application",
"IsPlainText": false, "subType": "rss",
"IsHTML": false, "suffix": "xml",
"NoUgly": true, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "",
"isPlainText": false,
"isHTML": false,
"noUgly": true,
"notAlternative": false
} }
], ],
"layouts": [ "layouts": [