summaryrefslogtreecommitdiffstats
path: root/tpl
AgeCommit message (Collapse)Author
2021-08-01Fix error handling for the time func aliasBjørn Erik Pedersen
Fixes #8835
2021-07-29tpl/lang: Add new localized versions of lang.FormatNumber etc.Bjørn Erik Pedersen
Fixes #8820
2021-07-28Handle toml.LocalDate and toml.LocalDateTime in front matterBjørn Erik Pedersen
See #8801
2021-07-28Switch to go-toml v2Bjørn Erik Pedersen
We have been using `go-toml` for language files only. This commit makes it the only TOML library. It's spec compliant and very fast. A benchark building a site with 200 pages with TOML front matter: ```bash name old time/op new time/op delta SiteNew/Regular_TOML_front_matter-16 48.5ms ± 1% 47.1ms ± 1% -2.85% (p=0.029 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_TOML_front_matter-16 16.9MB ± 0% 16.7MB ± 0% -1.56% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_TOML_front_matter-16 302k ± 0% 296k ± 0% -2.20% (p=0.029 n=4+4) ``` Note that the front matter unmarshaling is only a small part of building a site, so the above is very good. Fixes #8801
2021-07-27Add timezone support for front matter dates without oneBjørn Erik Pedersen
Fixes #8810
2021-07-27Localize time.FormatBjørn Erik Pedersen
Fixes #8797
2021-07-15hugofs: Make FileMeta a structBjørn Erik Pedersen
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct. This is easier to reason about, and it's more effective: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-16 71.5ms ± 3% 69.4ms ± 5% ~ (p=0.200 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-16 29.7MB ± 0% 27.9MB ± 0% -5.82% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-16 313k ± 0% 303k ± 0% -3.35% (p=0.029 n=4+4) ``` See #8749
2021-07-05Fix tab selection of disabled items in internal pagination templateRaoul
2021-06-29Fix date format in schema and opengraph templatesJoe Mooring
Fixes #8671
2021-06-18tpl: Rename err-missing-instagram-accesstoken => ↵Bjørn Erik Pedersen
error-missing-instagram-accesstoken To get it in line with the other.
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2021-06-08docs: Regenerate docs helperBjørn Erik Pedersen
2021-06-08tpl: Add a terse pagination template variant to improve performanceJoe Mooring
These calls are equivalent: {{ template "_internal/pagination.html" . }} {{ template "_internal/pagination.html" (dict "page" .) }} {{ template "_internal/pagination.html" (dict "page" . "format" "default") }} To use an alternate format: {{ template "_internal/pagination.html" (dict "page" . "format" "terse") }} Fixes #8599
2021-06-08Upgrade Instagram shortcodeBjørn Erik Pedersen
Fixes #7879
2021-06-07tpl/fmt: Add erroridf template funcBjørn Erik Pedersen
Fixes #8613
2021-06-07tpl/data: Print response body on HTTP errorsBjørn Erik Pedersen
Which makes it easier to debug.
2021-06-06tpl/data: Misc header improvements, tests, allow multiple headers of same keyBjørn Erik Pedersen
Closes #5617
2021-06-06tpl/data: Allows user-defined HTTP headers with getJSON and getCSVPaul Chamberlain
Updates #5617
2021-05-28Add math.Max and math.MinJoe Mooring
Closes #8583
2021-05-09tpl: Allow 'Querify' to take lone slice/interface argumentUjjwal Goyal
Querify can now take a lone string/interface slice (with string keys) as a parameter, or multiple string parameters, to build URL queries. Querify earlier used 'Dictionary' to add key/value pairs to a map to build URL queries. Changed to dynamically generate ordered key/value pairs. Cannot take string slice as key (earlier possible due to Dictionary). Added tests and benchmarks for querify. Closes #6735
2021-05-03tpl: Fix countwords to handle special charsJulien Midedji
Fixes #8479
2021-04-30deps: Update getkin/kin-openapi v0.60.0 => v0.61.Bjørn Erik Pedersen
2021-04-29Remove .Site.Authors from embedded templatesJoe Mooring
Closes #4458
2021-04-23tpl/collections: Fix where on type mismatchesBjørn Erik Pedersen
Fixes #8353
2021-04-23Make the shortcode template lookup for output formats stableBjørn Erik Pedersen
Fixes #7774
2021-04-21Fix Params case handling in where with slices of structs (e.g. Pages)Bjørn Erik Pedersen
Fixes #7009
2021-04-15Remove extraneous space from figure shortcodeJoe Mooring
Fixes #8401
2021-03-30tpl: Remove the FuzzMarkdownify func for nowBjørn Erik Pedersen
It has gotten us nothing but "build fails" mail and work we don't have time to follow up on.
2021-03-28Try to fix the fuzz buildBjørn Erik Pedersen
2021-03-14media: Make Type comparableBjørn Erik Pedersen
So we can use it and output.Format as map key etc. This commit also fixes the media.Type implementation so it does not need to mutate itself to handle different suffixes for the same MIME type, e.g. jpg vs. jpeg. This means that there are no Suffix or FullSuffix on media.Type anymore. Fixes #8317 Fixes #8324
2021-03-03Add support for Google Analytics v4Daniel Atwood
2021-02-23tpl: Add method mappings for strings.Contains, strings.ContainsAnyBjørn Erik Pedersen
Just to confirm/document the function signature.
2021-02-18tpl: Make the build green againBjørn Erik Pedersen
2021-02-18tpl: Regenerate internal templatesBjørn Erik Pedersen
2021-02-18tpl: Update date logic of opengraph and schema internal templatesDaniel Atwood
* Fix: updated date logic in opengraph template * Updated date logic in schema template * Reformatted opengraph and schema * Wrapped PublishDate and Lastmod in with
2021-02-18tpl: Add temporary patch to fix template data raceBjørn Erik Pedersen
Keep this as a separate commit so we can reapply it if needed. Fixes #7293
2021-02-18Add breaking tests for "map read and map write in templates"Bjørn Erik Pedersen
The fix upstream in Go was reverted, so we apply a temporary patch for this in Hugo. Updates #7293
2021-02-18Pull in latest Go template sourceBjørn Erik Pedersen
2021-02-18tpl/internal: Synch Go templates fork with Go 1.16devBjørn Erik Pedersen
2021-02-14Fix some humanize issuessusiwen8
Fixes #7912
2021-02-06tpl/embedded: Exclude pages without Permalink from sitemapJeremy Epstein
2021-02-01tpl/data: Add default user-agent header for getJSON requestsBaris Ceviz
2021-01-23tpl/os: remove 1mb limit for readFile.Aleksandr Demakin
2021-01-22tpl: Fix race condition in text template baseofCameron Moore
Copy most of the htmltemplate cloning to the textemplate implementation in the same function.
2021-01-08tpl: Fix metrics hint trackingCameron Moore
When tracking for cache hints, track the same template name as the call to MeasureSince in Execute. When referencing a partial "foo", the value of `n` does not match `templ.Name()` (`partials/foo` versus `partials/foo.html`). This was causing hints to go untracked since there was no existing metric to append the hint to. Fixes #8125
2021-01-08tpl: Do not return errors in substr for out-of-bounds casesCameron Moore
Most other substr implementations don't error out in out-of-bounds cases but simply return an empty string (or a value that's printed as an empty string). We'll follow their lead and not exit template execution. Allow the user decide what to do with the empty result. Fixes #8113
2021-01-08tpl: Add missing test scenario for strings.SubstrCameron Moore
2020-12-30Add Dart Sass supportBjørn Erik Pedersen
But note that the Dart Sass Embedded Protocol is still in beta (beta 5), a main release scheduled for Q1 2021. Fixes #7380 Fixes #8102
2020-12-19Improve LookPathBjørn Erik Pedersen
2020-12-16tpl: Regenerate templatesBjørn Erik Pedersen