Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-12Make string sorting (e.g. ByTitle, ByLinkTitle and ByParam) language awareBjørn Erik Pedersen
Fixes #2180
2022-04-05Localize all the GroupBy*Date methodsBjørn Erik Pedersen
Fixes #9745
2022-04-05Add environment as a new filter to _cascade.targetCathrine Paulsen
Fixes #9612
2022-03-25resources: Add more details to .ErrBjørn Erik Pedersen
This commit adds a .Data object (a map with `Body`, `StatusCode` etc.) to the .Err returned from `resources.GetRemote`, which means you can now do: ``` {{ with .Err }} {{ range $k, $v := .Data }} {{ end }} {{ end }} ``` Fixes #9708
2022-03-22Fix some typoscuishuang
Signed-off-by: cuishuang <imcusg@gmail.com> [foka@debian.org: Resolve merge conflict and squash 2 commits] Signed-off-by: Anthony Fok <foka@debian.org>
2022-03-18all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2022-03-08Cache reflect.MethodByNameBjørn Erik Pedersen
The isolated benchmark for the function is obviously much faster: ```bash name old time/op new time/op delta GetMethodByName-10 1.21µs ± 7% 0.23µs ± 5% -81.42% (p=0.029 n=4+4) name old alloc/op new alloc/op delta GetMethodByName-10 680B ± 0% 0B -100.00% (p=0.029 n=4+4) name old allocs/op new allocs/op delta GetMethodByName-10 20.0 ± 0% 0.0 -100.00% (p=0.029 n=4+4) ``` But more pleasing is the overall performance looking at the site benchmarks: ```bash name old time/op new time/op delta SiteNew/Regular_Bundle_with_image-10 6.25ms ± 2% 6.10ms ± 2% ~ (p=0.057 n=4+4) SiteNew/Regular_Bundle_with_JSON_file-10 6.30ms ± 2% 5.66ms ±11% ~ (p=0.057 n=4+4) SiteNew/Regular_Tags_and_categories-10 22.2ms ± 2% 17.4ms ± 1% -21.88% (p=0.029 n=4+4) SiteNew/Regular_Canonify_URLs-10 108ms ± 0% 107ms ± 0% -1.20% (p=0.029 n=4+4) SiteNew/Regular_Deep_content_tree-10 36.1ms ± 1% 33.8ms ± 1% -6.44% (p=0.029 n=4+4) SiteNew/Regular_TOML_front_matter-10 24.9ms ± 1% 22.6ms ± 1% -9.30% (p=0.029 n=4+4) SiteNew/Regular_Many_HTML_templates-10 17.9ms ± 1% 16.7ms ± 1% -6.43% (p=0.029 n=4+4) SiteNew/Regular_Page_collections-10 23.3ms ± 1% 22.0ms ± 0% -5.58% (p=0.029 n=4+4) SiteNew/Regular_List_terms-10 8.00ms ± 1% 7.63ms ± 0% -4.62% (p=0.029 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Bundle_with_image-10 2.10MB ± 0% 2.07MB ± 0% -1.46% (p=0.029 n=4+4) SiteNew/Regular_Bundle_with_JSON_file-10 1.88MB ± 0% 1.85MB ± 0% -1.76% (p=0.029 n=4+4) SiteNew/Regular_Tags_and_categories-10 13.5MB ± 0% 11.6MB ± 0% -13.99% (p=0.029 n=4+4) SiteNew/Regular_Canonify_URLs-10 96.1MB ± 0% 95.8MB ± 0% -0.40% (p=0.029 n=4+4) SiteNew/Regular_Deep_content_tree-10 28.4MB ± 0% 27.3MB ± 0% -3.83% (p=0.029 n=4+4) SiteNew/Regular_TOML_front_matter-10 16.9MB ± 0% 15.1MB ± 0% -10.58% (p=0.029 n=4+4) SiteNew/Regular_Many_HTML_templates-10 8.98MB ± 0% 8.44MB ± 0% -6.04% (p=0.029 n=4+4) SiteNew/Regular_Page_collections-10 17.1MB ± 0% 16.5MB ± 0% -3.91% (p=0.029 n=4+4) SiteNew/Regular_List_terms-10 3.92MB ± 0% 3.72MB ± 0% -5.03% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Bundle_with_image-10 25.8k ± 0% 24.9k ± 0% -3.49% (p=0.029 n=4+4) SiteNew/Regular_Bundle_with_JSON_file-10 25.8k ± 0% 24.9k ± 0% -3.49% (p=0.029 n=4+4) SiteNew/Regular_Tags_and_categories-10 288k ± 0% 233k ± 0% -18.90% (p=0.029 n=4+4) SiteNew/Regular_Canonify_URLs-10 375k ± 0% 364k ± 0% -2.80% (p=0.029 n=4+4) SiteNew/Regular_Deep_content_tree-10 314k ± 0% 283k ± 0% -9.77% (p=0.029 n=4+4) SiteNew/Regular_TOML_front_matter-10 302k ± 0% 252k ± 0% -16.55% (p=0.029 n=4+4) SiteNew/Regular_Many_HTML_templates-10 133k ± 0% 117k ± 0% -11.81% (p=0.029 n=4+4) SiteNew/Regular_Page_collections-10 202k ± 0% 183k ± 0% -9.55% (p=0.029 n=4+4) SiteNew/Regular_List_terms-10 55.6k ± 0% 49.8k ± 0% -10.40% (p=0.029 n=4+4) ``` Thanks to @quasilyte for the suggestion. Fixes 9386
2022-02-27Rename Codeowners() to CodeOwners()Bjørn Erik Pedersen
2022-02-24Add Markdown diagrams and render hooks for code blocksBjørn Erik Pedersen
You can now create custom hook templates for code blocks, either one for all (`render-codeblock.html`) or for a given code language (e.g. `render-codeblock-go.html`). We also used this new hook to add support for diagrams in Hugo: * Goat (Go ASCII Tool) is built-in and enabled by default; just create a fenced code block with the language `goat` and start draw your Ascii diagrams. * Another popular alternative for diagrams in Markdown, Mermaid (supported by GitHub), can also be implemented with a simple template. See the Hugo documentation for more information. Updates #7765 Closes #9538 Fixes #9553 Fixes #8520 Fixes #6702 Fixes #9558
2022-02-24Add support for CODEOWNERSMarshall Cottrell
Fixes #9474
2022-02-23Add page.StoreBjørn Erik Pedersen
Fixes #9546
2022-02-14Finally remove deprecated Page methodsBjørn Erik Pedersen
They have been deprecated for a very long time, first with a warning, then with an ERROR. Now they are removed. Closes #4117
2022-02-10Fix validation of Page Kind in cascade target mapJoe Mooring
Fixes #8888
2022-01-27Make the RenderString content provider fix more generalBjørn Erik Pedersen
Updates #9383
2022-01-27Fix .RenderString issue in .TranslationsPaul Gottschling
Fixes #9383
2022-01-12Only create LazyContentProvider for the non-rendering SiteBjørn Erik Pedersen
Which saves a fair amound of allocations: ``` gobench --package ./hugolib --bench "SiteNew/Regular_D" --base master ``` Before: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-10 40.7ms ± 3% 41.2ms ± 1% ~ (p=0.343 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-10 27.7MB ± 0% 28.8MB ± 0% +3.76% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-10 304k ± 0% 329k ± 0% +8.07% (p=0.029 n=4+4) ``` After: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-10 34.2ms ± 1% 34.7ms ± 1% ~ (p=0.114 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-10 27.7MB ± 0% 28.1MB ± 0% +1.38% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-10 304k ± 0% 314k ± 0% +3.03% (p=0.029 n=4+4) ``` Updates #8919
2022-01-12Fix missing page data for alternative formatsPaul Gottschling
When a template calls the .Translations function and a Hugo environment is using multiple output formats, a template that calls methods like .Summary and .Len on each translation will unexpectedly show empty return values for these methods. This is because each pageOutput's ContentProvider is assigned to a page.NopPage in newPageOutput. When *HugoSites.render assigns pageContentOutputs to pageOutputs in *pageState.shiftToOutputFormat, it reuses pageContentOutputs from other pageOutputs, leaving some pageContentOutputs as NopPages. While this approach conserves resources, sometimes it means that a template will unexpectedly call a method on a pageContentOutput that is actually a NopPage. In the case of ContentProvider methods called on translations for alternative output formats, the methods were called on NopPages. This change introduces LazyContentProvider, which performs late initialization when one of its methods is called. This way, we can reuse content in "normal" cases but ensure that ContentProvider methods work as expected when a pageOutput is not assigned a pageContentOutput during the initial pre-render phase. Fixes #8919
2022-01-11Add hugo.DepsBjørn Erik Pedersen
Fixes #8949
2022-01-04Misc depreation updatesBjørn Erik Pedersen
* Deprecate .Page.Path when backed by a file * site.Permalinks * --ignoreVendor (use --ignoreVendorPaths) Closes #9348 Closes #9349
2022-01-04Make the deprecated Page/File methods (from Hugo 0.55) ERRORBjørn Erik Pedersen
Closes #9346
2022-01-04Fix surprise OutputFormat.Rel overwritingPaul Gottschling
In page.NewOutputFormat, we take an output.Format f and use it to create a page.OutputFormat. If the format is canonical, we assign the final OutputFormat's Rel to "canonical" rather than using f.Rel. However, this leads to unexpected behavior for custom output formats, where a user can define a "rel" for a format via the config file. For example, the standard for "humans.txt" files requires using rel="author" in HTML "link" elements. Meanwhile, humans.txt is usually the only format used for its content. As a result, for Hugo configurations that define a humans.txt custom output format, Hugo will render "link" elements to content in this format with rel="canonical," rather than "author" as required by the standard. This commit changes page.NewOutputFormat to check whether a given format is user defined and, if so, skips assigning Rel to "canonical," even if isCanonical is true. Fixes #8030
2021-12-10Allow user to handle/ignore errors in resources.GetBjørn Erik Pedersen
In Hugo 0.90.0 we introduced remote support in `resources.Get`. But with remote resources comes with a higher chance of failing a build (network issues, remote server down etc.). Before this commit we always failed the build on any unexpected error. This commit allows the user to check for any error (and potentially fall back to a default local resource): ```htmlbars {{ $result := resources.Get "https://gohugo.io/img/hugo-logo.png" }} {{ with $result }} {{ if .Err }} {{/* log the error, insert a default image etc. *}} {{ else }} <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> {{ end }} {{ end }} ``` Note that the default behaviour is still to fail the build, but we will delay that error until you start using the `Resource`. Fixes #9529
2021-07-29Go back to WARNING for Page deprecationsBjørn Erik Pedersen
Do that in the next release, let's reduce the noise, we have enough changes as it is.
2021-07-28Handle toml.LocalDate and toml.LocalDateTime in front matterBjørn Erik Pedersen
See #8801
2021-07-27Add timezone support for front matter dates without oneBjørn Erik Pedersen
Fixes #8810
2021-07-25Bump all long-living deprecations to ERRORsBjørn Erik Pedersen
2021-07-10Add config.cascadeBjørn Erik Pedersen
This commit adds support for using the `cascade` keyword in your configuration file(s), e.g. `config.toml`. Note that * Every feature of `cascade` is available, e.g. `_target` to target specific page sets. * Pages, e.g. the home page, can overwrite the cascade defined in config. Fixes #8741
2021-06-18Split out the puthe path/filepath functions into common/pathsBjørn Erik Pedersen
So they can be used from the config package without cyclic troubles. Updates #8654
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-08Upgrade Instagram shortcodeBjørn Erik Pedersen
Fixes #7879
2021-06-07tpl/fmt: Add erroridf template funcBjørn Erik Pedersen
Fixes #8613
2021-04-25resources/page: Fix permalinks pattern detection for some of the sections ↵Bjørn Erik Pedersen
variants See #8363
2021-03-30Add slice syntax to sections permalinks configBjørn Erik Pedersen
Fixes #8363
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
2020-12-28GroupByParamDate now supports datetimesHorst Gutmann
Previously, the method only worked for date strings but not (for instance) full RFC3339 datetime strings.
2020-12-16tpl: Regenerate templatesBjørn Erik Pedersen
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-11-22resources: Preserve url set in frontmatter without sanitizingSatowTakeshi
related #6007 (already closed)
2020-10-22Allow getJSON errors to be ignoredBjørn Erik Pedersen
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
2020-10-06pagemeta: Make BuildConfig.Render an enumBjørn Erik Pedersen
Allowing links on pages without rendering them. Fixes #7783
2020-10-06Allow cascade to be a slice with a _target discriminatorBjørn Erik Pedersen
Fixes #7782
2020-10-03tpl: Add Do Not Track (dnt) option to Vimeo shortcodeJosh Gerdes
Added a Vimeo EnableDNT privacy option to the Hugo config. This will enable the Vimeo 'Do Not Track' flag when either Vimeo shortcode tempalte options are used. When enabled, it will force the Vimeo player to be blocked from tracking any session data, including all cookies and stats. Fixes #7700
2020-09-07Fix some change detection issues on server reloadsBjørn Erik Pedersen
* Fix change detection when .GetPage/site.GetPage is used from shortcode * Fix stale content for GetPage results with short name lookups on server reloads Fixes #7623 Fixes #7624 Fixes #7625
2020-06-19Make GroupByParamDate work with string paramsBjørn Erik Pedersen
Fixes #3983
2020-06-19Add GroupByLastmodBjørn Erik Pedersen
Fixes #7408
2020-06-18Rename taxonomy kinds from taxonomy to term, taxonomyTerm to taxonomyBjørn Erik Pedersen
And we have taken great measures to limit potential site breakage: * For `disableKinds` and `outputs` we try to map from old to new values if possible, if not we print an ERROR that can be toggled off if not relevant. * The layout lookup is mostly compatible with more options for the new `term` kind. That leaves: * Where queries in site.Pages using taxonomy/taxonomyTerm Kind values as filter. * Other places where these kind value are used in the templates (classes etc.) Fixes #6911 Fixes #7395
2020-06-15Fix order of GetTermsBjørn Erik Pedersen
Preserve the order from front matter, which would be behaviour when doing this manually (before GetTerms). Fixes #7213
2020-06-12Regenerate templatesBjørn Erik Pedersen
2020-03-24Fix _build.list.local logicBjørn Erik Pedersen
Fixes #7089