summaryrefslogtreecommitdiffstats
path: root/tpl
AgeCommit message (Collapse)Author
2019-07-15tpl/collections: Add Merge functionBjørn Erik Pedersen
Merges two maps recursively and returns a new one. Merge is case-insensitive. Fixes #5992
2019-06-26tpl/tplimpl: Regenerate templatesBjørn Erik Pedersen
2019-06-26Pagination - do not render href if no next itemMark Mandel
When using a html link checker with Hugo, this template consistently causes errors, as it renders `href=""` attributes when next/previous is disabled. This change makes it so that the `href` attribute is not rendered at all if `HasNext` is false - which is better semantically, and makes link checking far easier.
2019-06-10tpl/collections: Fix slice type handling in sortBjørn Erik Pedersen
The `sort` template func was producing a `[]page.Page` which did not work in `.Paginate`. Fixes #6023
2019-06-09tpl/collections: Unwrap any interface value in sort and whereBjørn Erik Pedersen
Hugo `0.55.0` introduced some new interface types for `Page` etc. This worked great in general, but there were cases where this would fail in `where` and `sort`. One such example would be sorting by `MenuItem.Page.Date` where `Page` on `MenuItem` was a small subset of the bigger `page.Page` interface. This commit fixes that by unwrapping such interface values. Fixes #5989
2019-05-30tpl/collections: Convert numeric values to float64 and compare themAnton Harniakou
Fixes #5685
2019-05-26Remove references to Google+Bruno Amaral
According to google, this is no longer supported and structured data should be used instead: https://support.google.com/webmasters/answer/6083347?hl=en
2019-05-17tpl: Fix internal templates usage of safeHTMLAttrRodolfo Carvalho
The `safeHTMLAttr` function operates on a full attribute definition, not just within the attribute value. Docs: https://gohugo.io/functions/safehtmlattr/ For `opengraph.html`, run the whole `content` HTML attribute through `safeHTMLAttr`. That will preserve `+` signs in formatted dates. For `vimeo_simple.html`, `safeHTMLAttr` was in the context of an attribute value, thus having no effect. In this case we could replace it with `safeURL`, but since the code is coming from an API it is safer to just let Go's template engine sanitize the value as it already does with `provider_url`. Fixes #5236 (no need to change Go upstream) Related to #5246
2019-05-04i18n: Move the package below /langsBjørn Erik Pedersen
To get fewer top level packages.
2019-04-29tpl/compare: Fix nil compare in eq/ne for interface valuesBjørn Erik Pedersen
Fixes #5905
2019-04-27tpl: Fix hugo package name and add godocsCameron Moore
2019-04-27tpl: Provide more detailed errors in WhereCameron Moore
2019-04-24hugolib: Avoid recloning of shortcode templatesBjørn Erik Pedersen
```bash benchmark old ns/op new ns/op delta BenchmarkSiteNew/Bundle_with_image-4 14572242 14382188 -1.30% BenchmarkSiteNew/Bundle_with_JSON_file-4 13683922 13738196 +0.40% BenchmarkSiteNew/Multiple_languages-4 41912231 25192494 -39.89% benchmark old allocs new allocs delta BenchmarkSiteNew/Bundle_with_image-4 57496 57493 -0.01% BenchmarkSiteNew/Bundle_with_JSON_file-4 57492 57501 +0.02% BenchmarkSiteNew/Multiple_languages-4 242422 118809 -50.99% benchmark old bytes new bytes delta BenchmarkSiteNew/Bundle_with_image-4 3845077 3844065 -0.03% BenchmarkSiteNew/Bundle_with_JSON_file-4 3627442 3627798 +0.01% BenchmarkSiteNew/Multiple_languages-4 13963502 7543885 -45.97% ``` Fixes #5890
2019-04-19tpl/collections: Return error on invalid input in inBjørn Erik Pedersen
See #5875
2019-04-18tpl/collections: Make Pages etc. work with the in funcBjørn Erik Pedersen
Fixes #5875
2019-04-18tpl/collections: Make Pages etc. work in uniqBjørn Erik Pedersen
Fixes #5852
2019-04-16tpl/tplimpl: Handle late transformation of templatesBjørn Erik Pedersen
Fixes #5865
2019-04-15hugolib: Fix shortcode namespace issueBjørn Erik Pedersen
Fixes #5863
2019-04-09tpl/tplimpl: Replace deprecated .GetParam usageBjørn Erik Pedersen
Fixes #5834
2019-04-08Misc paginator adjustmentsBjørn Erik Pedersen
* Rewind paginator for server mode * Add some more related tests. * Replace the clumsy scratch constructs in internal paginator template with variables See #5825
2019-04-05hugolib: Consider summary in front matter for .SummaryJim McDonald
Add the ability to have a `summary` page variable that overrides the auto-generated summary. Logic for obtaining summary becomes: * if summary divider is present in content, use the text above it * if summary variables is present in page metadata, use that * auto-generate summary from first _x_ words of the content Fixes #5800
2019-04-02tpl: Allow the partial template func to return any typeBjørn Erik Pedersen
This commit adds support for return values in partials. This means that you can now do this and similar: {{ $v := add . 42 }} {{ return $v }} Partials without a `return` statement will be rendered as before. This works for both `partial` and `partialCached`. Fixes #5783
2019-03-24all: Apply staticcheck recommendationsBjørn Erik Pedersen
2019-03-23Run gofmt -sBjørn Erik Pedersen
2019-03-23Make Page an interfaceBjørn Erik Pedersen
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
2019-03-16tpl/tplimpl: Fix mutex unlockBjørn Erik Pedersen
2019-03-06tpl/tplimpl: Fix template truth logicBjørn Erik Pedersen
Before this commit, due to a bug in Go's `text/template` package, this would print different output for typed nil interface values: ``` {{ if .AuthenticatedUser }}User is authenticated!{{ else }}{{ end }} {{ if not .AuthenticatedUser }}{{ else }}}User is authenticated!{{ end }} ``` This commit works around this by wrapping every `if` and `with` with a custom `getif` template func with truth logic that matches `not`, `and` and `or`. Those 3 template funcs from Go's stdlib are now pulled into Hugo's source tree and adjusted to support custom zero values, e.g. types that implement `IsZero`. This means that you can now do: ``` {{ with .Date }}{{ . }}{{ end }} ``` And it would work as expected. Fixes #5738
2019-02-06Support nested keys/fields with missing values with the `where` functionAnton Harniakou
Before this commit `where` would produce an error and bail building the site. Now, `where` simply skips an element of a collection and does not add it to the final result. Closes #5637 Closes #5416
2019-02-02tpl: Fix strings.HasPrefix args orderIskander (Alex) Sharipov
2019-02-01tpl/data: Adjust testsBjørn Erik Pedersen
See #5643
2019-02-01tpl/data: Prevent getJSON and getCSV fetch failure from aborting buildAnthony Fok
Fixes #5643
2019-01-31Fix some inline shortcode issuesBjørn Erik Pedersen
Fixes #5645 Fixes #5653
2019-01-25Fix OpenGraph image fallback to site paramsElliot Murphy
Signed-off-by: Elliot Murphy <statik@users.noreply.github.com>
2019-01-20Fix Params case handling in the new site globalBjørn Erik Pedersen
Fixes #5615
2019-01-02resources: Move resource interfaces into its own packageBjørn Erik Pedersen
2019-01-02resource: Move resource processors into sub-packagesBjørn Erik Pedersen
2018-12-28tpl: Fix reflectCameron Moore
Fixes #5564
2018-12-27Make docshelper run againBjørn Erik Pedersen
Fixes #5568
2018-12-23tpl/transform: Include options in cache keyBjørn Erik Pedersen
See #5555
2018-12-23Rename CSV option from comma to delimiterBjørn Erik Pedersen
See #5555
2018-12-23tpl/transform: Simplify transform.Unmarshal funcBjørn Erik Pedersen
See #5428
2018-12-23Add CSV support to transform.UnmarshalBjørn Erik Pedersen
Fixes #5555
2018-12-23tpl/transform: Add transform.Unmarshal funcBjørn Erik Pedersen
Fixes #5428
2018-12-19tpl: Fix case handling in cast paramsBjørn Erik Pedersen
Fixes #5538
2018-12-07tpl: Add reflect namespaceCameron Moore
Add a reflect namespace that offers a two boolean functions for testing if a value is a map or slice. Fixes #4081
2018-12-06tpl/hugo: Use the correct Hugo varBjørn Erik Pedersen
See #5467
2018-12-06Add tpl/site and tpl/hugoBjørn Erik Pedersen
This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc. Fixes #5470 Fixes #5467 Fixes #5503
2018-11-30tpl: Add godoc packages commentsCameron Moore
Also fix package name in tpl/templates.
2018-11-27tpl/path: Add testsCameron Moore
2018-11-27tpl: Regenerate templatesBjørn Erik Pedersen