summaryrefslogtreecommitdiffstats
path: root/output
AgeCommit message (Collapse)Author
2018-09-07Improve some godoc commentsCameron Moore
2018-09-07output: Fix golint godoc issuesCameron Moore
2018-08-28Improve minifier MIME type resolutionBjørn Erik Pedersen
This commit also removes the deprecated `Suffix` from MediaType. Now use `Suffixes` and put the MIME type suffix in the type, e.g. `application/svg+xml`. Fixes #5093
2018-07-10media: Allow multiple file suffixes per media typeBjørn Erik Pedersen
Before this commit, `Suffix` on `MediaType` was used both to set a custom file suffix and as a way to augment the mediatype definition (what you see after the "+", e.g. "image/svg+xml"). This had its limitations. For one, it was only possible with one file extension per MIME type. Now you can specify multiple file suffixes using "suffixes", but you need to specify the full MIME type identifier: [mediaTypes] [mediaTypes."image/svg+xml"] suffixes = ["svg", "abc ] In most cases, it will be enough to just change: [mediaTypes] [mediaTypes."my/custom-mediatype"] suffix = "txt" To: [mediaTypes] [mediaTypes."my/custom-mediatype"] suffixes = ["txt"] Hugo will still respect values set in "suffix" if no value for "suffixes" is provided, but this will be removed in a future release. Note that you can still get the Media Type's suffix from a template: {{ $mediaType.Suffix }}. But this will now map to the MIME type filename. Fixes #4920
2018-07-09Revert "Consider root and current section's content type if set in front matter"Bjørn Erik Pedersen
This reverts commit c790029e1dbb0b66af18d05764bd6045deb2e180.
2018-07-09Revert "output: gofmt -l -w output/layout.go"Bjørn Erik Pedersen
This reverts commit f465571b33c8736a95534dd43f07527869d1eec3.
2018-07-02output: Fix the shortcodes/partials vs base template detectionBjørn Erik Pedersen
Fixes #4897
2018-07-02output: gofmt -l -w output/layout.goAnthony Fok
2018-06-30Consider root and current section's content type if set in front matterBjørn Erik Pedersen
This should allow for less duplication of templates. Before this commit it was possible to override the content page of a given page/section, but only one page at a time. Full "template sets" can now be inherited by setting `type: blog` etc. in the section content page's front matter, and that type will be considered when looking for layouts for all pages in that section. For nested sections, it will use consider both `type` set in the current section first, then `type` set in the first section below home, e.g. `/docs`. This commit also adds a new Page method: `FirstSection`. This navigates up to the first section below home (e.g. `/docs`). For the home page it will return itself. Fixes #4891
2018-06-12docs: Update theme documentationBjørn Erik Pedersen
See #4460
2018-06-10Add support for theme composition and inheritanceBjørn Erik Pedersen
This commit adds support for theme composition and inheritance in Hugo. With this, it helps thinking about a theme as a set of ordered components: ```toml theme = ["my-shortcodes", "base-theme", "hyde"] ``` The theme definition example above in `config.toml` creates a theme with the 3 components with presedence from left to right. So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`. Hugo uses two different algorithms to merge the filesystems, depending on the file type: * For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files. * For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen. The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are plans to improve on this and get a URL scheme so this can be resolved automatically. Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure: * `params` (global and per language) * `menu` (global and per language) * `outputformats` and `mediatypes` The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts. A final note: Themes/components can also have a `theme` definition in their `config.toml` and similar, which is the "inheritance" part of this commit's title. This is currently not supported by the Hugo theme site. We will have to wait for some "auto dependency" feature to be implemented for that to happen, but this can be a powerful feature if you want to create your own theme-variant based on others. Fixes #4460 Fixes #4450
2018-03-10Allow partial redefinition of the ouputs configBjørn Erik Pedersen
Fixes #4487
2018-03-09output: Fix buildBjørn Erik Pedersen
See #4484
2018-03-09outputs: Adjust the layout examplesBjørn Erik Pedersen
2018-01-25hugolib, output: Fix robots.txt in multihost modeBjørn Erik Pedersen
Fixes #4193
2018-01-25output: Remove duplicate layout lookup layoutsBjørn Erik Pedersen
This can happen for sections if Type and Section are equal. Of no real practical difference, but it makes the docs less confusing. Fixes #4319
2018-01-19output: Add some more layout docshelper variantsBjørn Erik Pedersen
2018-01-18output: Redo the docshelper layouts examplesBjørn Erik Pedersen
2018-01-14layout: Respect Type and Layout for list template selectionBjørn Erik Pedersen
This commit also has some other nice side-effects: * The layout logic is unified for all page types, which should make it less surprising * Page.Render now supports all types * The legacy "indexes" type is removed from the template lookup order. This is an undocumented type from early Hugo days. This means that having a template in, say, `/layouts/indexes/list.html` will no longer work. * The theme override logic is improved. As an example, an `index.html` in theme will now wn over a `_default/list.html` in the project, which most will expect. Fixes #3005 Fixes #3245
2017-11-17output: Fall back to unstranslated base templateBjørn Erik Pedersen
Fixes #3893
2017-09-29Clean up lint in various packagesCameron Moore
Changes fall into one of the following: - gofmt -s - receiver name is inconsistent - omit unused 2nd value from range - godoc comment formed incorrectly - err assigned and not used - if block ends with a return statement followed by else
2017-09-03output: Fix taxonomy term base template lookupBjørn Erik Pedersen
To make sure it uses the base templates in _default as a last resort. Fixes #3856
2017-08-11output: Improve the base template identificationBjørn Erik Pedersen
See https://discourse.gohugo.io/t/main-block-not-rendered-in-custom-archetypes-layout/7917/3
2017-08-07all: Fix spellingBjørn Erik Pedersen
And some other minor issues.
2017-08-07all: gofmt -sBjørn Erik Pedersen
2017-08-03Add some missing doc commentsJorin Vogel
As pointed out by the linter, some exported functions and types are missing doc comments. The linter warnings have been reduced from 194 to 116. Not all missing comments have been added in this commit though.
2017-07-31output: Add JSON tags to FormatBjørn Erik Pedersen
See https://github.com/gohugoio/hugoDocs/issues/114
2017-07-22docs: Add RSS template lookup exampleBjørn Erik Pedersen
2017-07-04output: Support templates per site/languageBjørn Erik Pedersen
This applies to both regular templates and shortcodes. So, if the site language is French and the output format is AMP, this is the (start) of the lookup order for the home page: 1. index.fr.amp.html 2. index.amp.html 3. index.fr.html 4. index.html 5. ... Fixes #3360
2017-06-20output: Identify extension-less text types as textBjørn Erik Pedersen
See #3614
2017-06-20media, hugolib: Support extension-less media typesBjørn Erik Pedersen
This change is motivated by Netlify's `_redirects` files, which is currently not possible to generate with Hugo. This commit adds a `Delimiter` field to media type, which defaults to ".", but can be blanked out. Fixes #3614
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-05-18output: Fix output format mixup in exampleBjørn Erik Pedersen
See #3481
2017-04-13output: Fix base theme vs project base template logicBjørn Erik Pedersen
Fixes #3323
2017-04-12hugolib, output: Do not lower case template namesBjørn Erik Pedersen
This regression was introduced in Hugo 0.20. Fixes #3333
2017-04-08hugolib, output: Add NotAlternative to OutputFormatBjørn Erik Pedersen
To make sure CSS and similar does not appear in the AlternativeOutputFormats list.
2017-04-07all: Document the Output Formats featureBjørn Erik Pedersen
This commit also adds a new command, docshelper, with some utility funcs that adds a JSON datafiles to /docs/data that would be a pain to create and maintain by hand. Fixes #3242
2017-04-07output: Add some sane defaults for output formatBjørn Erik Pedersen
Fixes #3290
2017-04-06media, output: Fix spellingBjørn Erik Pedersen
2017-04-04output: Make template name lower casedBjørn Erik Pedersen
2017-04-04media: Add DecodeTypesBjørn Erik Pedersen
And clean up the media package.
2017-04-04output: Add output formats decoderBjørn Erik Pedersen
And clean up the output package.
2017-04-04output: Add CSV to the global output formats listBjørn Erik Pedersen
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
Before this commit, Hugo used `html/template` for all Go templates. While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc. This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use. A couple of notes: * The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work. * Ambiguous types will fall back to HTML. * Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials. * Shortcode templates are, by definition, currently HTML templates only. Fixes #3221
2017-04-02Revert "tpl: Rework to handle both text and HTML templates"Bjørn Erik Pedersen
Will have to take another stab at this ... This reverts commit 5c5efa03d2512749950b0d05a7d4bde35ecbdc37. Closes #3260
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
Before this commit, Hugo used `html/template` for all Go templates. While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc. This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use. A couple of notes: * The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work. * Ambiguous types will fall back to HTML. * Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials. * Shortcode templates are, by definition, currently HTML templates only. Fixes #3221
2017-04-01media, output: Add CSV type and formatBjørn Erik Pedersen
And make CSS correclty behave as plain text.
2017-03-28helpers, output: Fix spellingBjørn Erik Pedersen
2017-03-28hugolib, output: GofmtBjørn Erik Pedersen
2017-03-27hugolib, output: Restrict Render to regular PagesBjørn Erik Pedersen
Using it for list pages doesn't work and has potential weird side-effects. The user probably meant to range over .Site.ReqularPages, and that is now marked clearly in the log.