summaryrefslogtreecommitdiffstats
path: root/tpl
AgeCommit message (Collapse)Author
2024-01-30Create default link and image render hooksBjørn Erik Pedersen
Fixes #11933
2024-01-30Add warnidf template functionBjørn Erik Pedersen
Also rename config `ignoreErrors` => `ignoreLogs` But the old still works. Closes #9189
2024-01-28all: Run gofumpt -l -w .Bjørn Erik Pedersen
2024-01-28testing: Simplify some integration testsBjørn Erik Pedersen
2024-01-28tpl/data: Deprecate data.GetJSON and data.GetCSVBjørn Erik Pedersen
2024-01-28testing: Rename integration_test.go to PACKAGE_integration_test.goBjørn Erik Pedersen
Primary motivation making them easier to find in the code editor.
2024-01-27all: Rework page store, add a dynacache, improve partial rebuilds, and some ↵develop2024Bjørn Erik Pedersen
general spring cleaning There are some breaking changes in this commit, see #11455. Closes #11455 Closes #11549 This fixes a set of bugs (see issue list) and it is also paying some technical debt accumulated over the years. We now build with Staticcheck enabled in the CI build. The performance should be about the same as before for regular sized Hugo sites, but it should perform and scale much better to larger data sets, as objects that uses lots of memory (e.g. rendered Markdown, big JSON files read into maps with transform.Unmarshal etc.) will now get automatically garbage collected if needed. Performance on partial rebuilds when running the server in fast render mode should be the same, but the change detection should be much more accurate. A list of the notable new features: * A new dependency tracker that covers (almost) all of Hugo's API and is used to do fine grained partial rebuilds when running the server. * A new and simpler tree document store which allows fast lookups and prefix-walking in all dimensions (e.g. language) concurrently. * You can now configure an upper memory limit allowing for much larger data sets and/or running on lower specced PCs. We have lifted the "no resources in sub folders" restriction for branch bundles (e.g. sections). Memory Limit * Hugos will, by default, set aside a quarter of the total system memory, but you can set this via the OS environment variable HUGO_MEMORYLIMIT (in gigabytes). This is backed by a partitioned LRU cache used throughout Hugo. A cache that gets dynamically resized in low memory situations, allowing Go's Garbage Collector to free the memory. New Dependency Tracker: Hugo has had a rule based coarse grained approach to server rebuilds that has worked mostly pretty well, but there have been some surprises (e.g. stale content). This is now revamped with a new dependency tracker that can quickly calculate the delta given a changed resource (e.g. a content file, template, JS file etc.). This handles transitive relations, e.g. $page -> js.Build -> JS import, or $page1.Content -> render hook -> site.GetPage -> $page2.Title, or $page1.Content -> shortcode -> partial -> site.RegularPages -> $page2.Content -> shortcode ..., and should also handle changes to aggregated values (e.g. site.Lastmod) effectively. This covers all of Hugo's API with 2 known exceptions (a list that may not be fully exhaustive): Changes to files loaded with template func os.ReadFile may not be handled correctly. We recommend loading resources with resources.Get Changes to Hugo objects (e.g. Page) passed in the template context to lang.Translate may not be detected correctly. We recommend having simple i18n templates without too much data context passed in other than simple types such as strings and numbers. Note that the cachebuster configuration (when A changes then rebuild B) works well with the above, but we recommend that you revise that configuration, as it in most situations should not be needed. One example where it is still needed is with TailwindCSS and using changes to hugo_stats.json to trigger new CSS rebuilds. Document Store: Previously, a little simplified, we split the document store (where we store pages and resources) in a tree per language. This worked pretty well, but the structure made some operations harder than they needed to be. We have now restructured it into one Radix tree for all languages. Internally the language is considered to be a dimension of that tree, and the tree can be viewed in all dimensions concurrently. This makes some operations re. language simpler (e.g. finding translations is just a slice range), but the idea is that it should also be relatively inexpensive to add more dimensions if needed (e.g. role). Fixes #10169 Fixes #10364 Fixes #10482 Fixes #10630 Fixes #10656 Fixes #10694 Fixes #10918 Fixes #11262 Fixes #11439 Fixes #11453 Fixes #11457 Fixes #11466 Fixes #11540 Fixes #11551 Fixes #11556 Fixes #11654 Fixes #11661 Fixes #11663 Fixes #11664 Fixes #11669 Fixes #11671 Fixes #11807 Fixes #11808 Fixes #11809 Fixes #11815 Fixes #11840 Fixes #11853 Fixes #11860 Fixes #11883 Fixes #11904 Fixes #7388 Fixes #7425 Fixes #7436 Fixes #7544 Fixes #7882 Fixes #7960 Fixes #8255 Fixes #8307 Fixes #8863 Fixes #8927 Fixes #9192 Fixes #9324
2024-01-25tpl/tplimpl: Fix incorrect lastBuildDate Daniel Terhorst-North
Fixes #11600 Co-authored-by: Joe Mooring <joe@mooring.com>
2024-01-25tpl: fix incorrect lastBuildDateDaniel Terhorst-North
Set the `<lastBuildDate>` field to be the most recent Lastmod date of all the posts in the current selection. Fixes #11600
2024-01-16parser/metadecoders: Add CSV lazyQuotes option to transform.UnmarshalJoe Mooring
If true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field. It defaults to false. Closes #11884
2023-12-29tpl/math: Add math.Rand template functionJoe Mooring
Closes #11833
2023-12-18all: Remove unused codeBjørn Erik Pedersen
Using x/tools/cmd/deadcode
2023-12-04Pull in the latest code from Go's template packages (#11771)Bjørn Erik Pedersen
Fixes #10707 Fixes #11507
2023-12-04tpl: Allow using page resources on the images page parameter for ↵Razon Yang
`opengraph`, `schema` and `twitter_cards` templates The page images selection order as follows: 1. Page's images parameter, image resources are supported. 2. Page's image resources that naming in *feature*, *cover* or *thumbnail* pattern. 3. If no page images specified, then the first one of site's images will be used as the fallback, supports site resources.
2023-12-04tpl/fmt: Print suppression help with erroridfJoe Mooring
Closes #11506
2023-12-04tpl/transform: Display Chroma highlighting errorsJoe Mooring
Closes #9642
2023-11-27tpl/transform: Add transform.XMLEscape template functionJoe Mooring
Fixes #3268
2023-11-27tpl/tplimpl: Remove superfluous type attr on script elementsJoe Mooring
Closes #6379
2023-11-16helpers: Fix TrimShortHTML used by markdownify and RenderStringJoe Mooring
Closes #11698
2023-11-01tpl/tplimpl: Fix deprecation logic in embedded templatesJoe Mooring
Closes #11658
2023-10-31Fix deprecation printing on info levelBjørn Erik Pedersen
Fixes #11638
2023-10-31tpl/tplimpl: Fix deprecation logic in RSS templateJoe Mooring
Closes #11639
2023-10-29tpl/urls: Return strings from URL functionsJoe Mooring
Closes #11511
2023-10-28tpl/collections: Make delimit return a stringBjørn Erik Pedersen
Closes #10876 Closes #11502
2023-10-26Revise the deprecation loggingBjørn Erik Pedersen
This introduces a more automatic way of increasing the log levels for deprecation log statements based on the version it was deprecated. The thresholds are a little arbitrary, but * We log INFO for 6 releases * We log WARN for another 6 releases * THen ERROR (failing the build) This should give theme authors plenty of time to catch up without having the log filled with warnings.
2023-10-21tpl/debug: Add average and median to timer outputBjørn Erik Pedersen
2023-10-20tpl/debug: Add debug.TimerBjørn Erik Pedersen
Closes #11580
2023-10-18hugolib: Deprecate .Site.DisqusShortnameJoe Mooring
Use .Site.Config.Services.Disqus.Shortname instead.
2023-10-18tpl/tplimpl: Fix dropped errorLars Lehtonen
2023-10-17hugolib: Deprecate .Site.GoogleAnalyticsJoe Mooring
Use .Site.Config.Services.GoogleAnalytics.ID instead.
2023-10-17tpl/tplimpl: Deprecate .Site.Author usage in RSS templateJoe Mooring
2023-10-17tpl/tplimpl: Deprecate .Site.Social usage with internal templatesJoe Mooring
2023-10-05all: Format files with gofmtOleksandr Redko
2023-09-27tpl/lang: Formally deprecate lang.NumFmtJoe Mooring
Use lang.FormatNumberCustom instead.
2023-09-27tpl/collections: Fix and deprecate echoParamsJoe Mooring
Fixes #11498
2023-09-23google_analytics_async.html: Add deprecation warningCarl Johnson
2023-09-21Upgrade to Go 1.21.1Bjørn Erik Pedersen
See https://github.com/golang/go/issues?q=milestone%3AGo1.21.1+label%3ACherryPickApproved Fixes #11474 Fixes #11414
2023-08-23Go 1.21 UpgradeBjørn Erik Pedersen
Fixes #11351
2023-08-03Add Page.RenderShortcodesBjørn Erik Pedersen
A layouts/shortcodes/include.html shortcode may look like this: ```html {{ $p := site.GetPage (.Get 0) }} {{ $p.RenderShortcodes }} ``` Fixes #7297
2023-07-28tpl/collections: Add BenchmarkWhereOpsBjørn Erik Pedersen
``` BenchmarkWhereOps/eq-10 8702 120410 ns/op 52280 B/op 2515 allocs/op BenchmarkWhereOps/ne-10 9829 120759 ns/op 52280 B/op 2515 allocs/op BenchmarkWhereOps/like-10 6754 176377 ns/op 52917 B/op 2515 allocs/op ```
2023-07-28tpl/collections: Add like operator to where functionJoe Mooring
Closes #11279
2023-07-28tpl/collections: Fix description of apply functionJoe Mooring
The collections.Apply template function cannot be used with maps.
2023-07-27Add a common regexp cacheBjørn Erik Pedersen
``` BenchmarkGetOrCompileRegexp-10 73959368 13.71 ns/op 0 B/op 0 allocs/op BenchmarkCompileRegexp-10 3143529 380.1 ns/op 872 B/op 10 allocs/op ```
2023-07-11tpl/collections: Fix WordCount (etc.) regression in Where, Sort, DelimitBjørn Erik Pedersen
Fixes #11234
2023-07-08Make imageConfig work with modulesBjørn Erik Pedersen
Fixes #11205
2023-06-28Fix output formats and media type per language config regressionBjørn Erik Pedersen
Fixes #11159
2023-06-28common/collections: Fix append regression to allow appending nilkhayyam
Closes #11180
2023-06-26tpl/tplimpl: Fix typo in global variable nameOleksandr Redko
2023-06-18Replace the old log setup, with structured logging etc.Bjørn Erik Pedersen
Fixes #11124
2023-06-15Fix upstream Go templates bug with reversed key/value assignmentBjørn Erik Pedersen
The template packages are based on go1.20.5 with the patch in befec5ddbbfbd81ec84e74e15a38044d67f8785b added. This also includes a security fix that now disallows Go template actions in JS literals (inside backticks). This will throw an error saying "... appears in a JS template literal". If you're really sure this isn't a security risk in your case, you can revert to the old behaviour: ```toml [security] [security.gotemplates] allowActionJSTmpl = true ``` See https://github.com/golang/go/issues/59234 Fixes #11112