Age | Commit message (Collapse) | Author |
|
See #4616
|
|
See #4616
|
|
disable check
See #4616
|
|
|
|
Having them in separate files should make maintainance easier.
When adding new or making changes to the templates:
```bash
mage generate
```
This will get the Go code in sync.
Fixes #4457
|
|
|
|
Fixes #4633
|
|
|
|
|
|
|
|
|
|
A sample config:
```toml
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true
[Languages]
[Languages.en]
weight = 10
title = "In English"
languageName = "English"
contentDir = "content/english"
[Languages.nn]
weight = 20
title = "På Norsk"
languageName = "Norsk"
contentDir = "content/norwegian"
```
The value of `contentDir` can be any valid path, even absolute path references. The only restriction is that the content dirs cannot overlap.
The content files will be assigned a language by
1. The placement: `content/norwegian/post/my-post.md` will be read as Norwegian content.
2. The filename: `content/english/post/my-post.nn.md` will be read as Norwegian even if it lives in the English content folder.
The content directories will be merged into a big virtual filesystem with one simple rule: The most specific language file will win.
This means that if both `content/norwegian/post/my-post.md` and `content/english/post/my-post.nn.md` exists, they will be considered duplicates and the version inside `content/norwegian` will win.
Note that translations will be automatically assigned by Hugo by the content file's relative placement, so `content/norwegian/post/my-post.md` will be a translation of `content/english/post/my-post.md`.
If this does not work for you, you can connect the translations together by setting a `translationKey` in the content files' front matter.
Fixes #4523
Fixes #4552
Fixes #4553
|
|
See #4521
|
|
As an example:
```html
{{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }}
```
Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English.
Fixes #4463
|
|
See #4443
|
|
This means that you can do something ala:
```html
{{ if ge .Hugo.Version "0.36" }}Reasonable new Hugo version!{{ end }}
```
The intented use is feature toggling, but please note that it will take some time and Hugo versions until this can be trusted. It does not work in older Hugo versions.
Fixes #4443
|
|
Usage:
```html
{{ "title = \"Hello World\"" | transform.Remarshal "json" | safeHTML }}
```
Fixes #4389
|
|
Also:
- Remove unnecessary space from `figure` tag if no class is specified.
- Update related tests.
- Add test cases for the changes made to the figure shortcode.
- Document the newly added target and rel parameters
- Add more detail to the documentation of all figure shortcode parameters.
|
|
This change is made in the "twitter_cards" internal template.
References:
- https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary-card-with-large-image
- https://twittercommunity.com/t/twitter-image-src-or-twitter-image/16085/7
|
|
The tplimpl package was misusing the TemplateLookupDescriptor.WorkingDir
field from the output package. By incorrectly setting it to the theme
directory instead of the site root, the user is unable to override theme
templates in some situations.
Fixes #3505
|
|
The new lookup order:
1) Page.Params.images if set
2) Image resources: images with name "feature" (priority), "cover", "thumbnail"
3) Site.Params.images if set
Fixes #4349
|
|
|
|
Fixes #4179
|
|
|
|
fixes #2187
|
|
This is in heavy use in rendering, so this makes a difference:
```bash
benchmark old ns/op new ns/op delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4 124551144 107743429 -13.49%
benchmark old allocs new allocs delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4 528684 435118 -17.70%
benchmark old bytes new bytes delta
BenchmarkSiteBuilding/TOML,num_langs=1,num_pages=500,tags_per_page=5,shortcodes,render-4 53306848 45147832 -15.31%
```
|
|
Fixes #4136
|
|
Fixes #4133
|
|
|
|
Fixes #4051
|
|
This commit adds support for multiple statDirs both on the global and language level.
A simple `config.toml` example:
```bash
staticDir = ["static1", "static2"]
[languages]
[languages.no]
staticDir = ["staticDir_override", "static_no"]
baseURL = "https://example.no"
languageName = "Norsk"
weight = 1
title = "På norsk"
[languages.en]
staticDir2 = "static_en"
baseURL = "https://example.com"
languageName = "English"
weight = 2
title = "In English"
```
In the above, with no theme used:
the English site will get its static files as a union of "static1", "static2" and "static_en". On file duplicates, the right-most version will win.
the Norwegian site will get its static files as a union of "staticDir_override" and "static_no".
This commit also concludes the Multihost support in #4027.
Fixes #36
Closes #4027
|
|
Fixes #4086
|
|
To make sure a cached partial is ony executed exactly once.
Performance same:
```bash
name old time/op new time/op delta
TemplateParamsKeysToLower-4 17.2µs ± 0% 16.5µs ± 0% ~ (p=1.000 n=1+1)
Partial-4 18.6µs ± 0% 19.4µs ± 0% ~ (p=1.000 n=1+1)
PartialCached-4 64.2ns ± 0% 63.7ns ± 0% ~ (p=1.000 n=1+1)
name old alloc/op new alloc/op delta
TemplateParamsKeysToLower-4 2.66kB ± 0% 2.66kB ± 0% ~ (all equal)
Partial-4 1.31kB ± 0% 1.31kB ± 0% ~ (all equal)
PartialCached-4 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
TemplateParamsKeysToLower-4 92.0 ± 0% 92.0 ± 0% ~ (all equal)
Partial-4 41.0 ± 0% 41.0 ± 0% ~ (all equal)
```
|
|
See #4086
|
|
It makes the code smaller
|
|
Fixes #4014
|
|
This reverts commit 0859d9dfe647db3b8a192da38ad7efb5480a29a1.
Fixes #3978
|
|
This commit adds a "cache potential" column when running `hugo --templateMetrics --templateMetricsHints`.
This is only calculated when `--templateMetricsHints` is set, as these calculations has an negative effect on the other timings.
This gives a value for partials only, and is a number between 0-100 that indicates if `partial` can be replaced with `partialCached`.
100 means that all execution of the same partial resulted in the same output.
You should do some manual research before going "all cache".
|
|
|
|
|
|
Add template function that will build a string from the given format
string and arguments, then log it to ERROR. This has an intended
side-effect of causing the build to fail, when executed.
Resolves #3817
|
|
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
|
|
Fixes #3839
|
|
Add a template function that allows conversion to float. This is
useful, for example, when passing aspect ratios into templates,
which tend to not be integers.
Fixes #3307
|
|
|
|
|
|
|
|
If you want to use Pygments, set `pygmentsUseClassic=true` in your site config.
Fixes #3888
|
|
Add a urls.Parse template function that front-ends url.Parse from the Go
stdlib.
Fixes #3849
|
|
Ceil and Floor are frontends for the stdlib math functions. The Round
implementation is essentially the same thing except that the Go stdlib
doesn't include a Round implementation in a stable release yet. I've
included the Round function slated for Go 1.10.
Fixes #3883
|