Commit graph

104 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
c6d650c8c8
tpl/tplimpl: Rework template management to get rid of concurrency issues
This more or less completes the simplification of the template handling code in Hugo started in v0.62.

The main motivation was to fix a long lasting issue about a crash in HTML content files  without front matter.

But this commit also comes with a big functional improvement.

As we now have moved the base template evaluation to the build stage we now use the same lookup rules for `baseof` as for `list` etc. type of templates.

This means that in this simple example you can have a `baseof` template for the `blog` section without having to duplicate the others:

```
layouts
├── _default
│   ├── baseof.html
│   ├── list.html
│   └── single.html
└── blog
    └── baseof.html
```

Also, when simplifying code, you often get rid of some double work, as shown in the "site building" benchmarks below.

These benchmarks looks suspiciously good, but I have repeated the below with ca. the same result. Compared to master:

```
name                              old time/op    new time/op    delta
SiteNew/Bundle_with_image-16        13.1ms ± 1%    10.5ms ± 1%  -19.34%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16    13.0ms ± 0%    10.7ms ± 1%  -18.05%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16      46.4ms ± 2%    43.1ms ± 1%   -7.15%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16            52.2ms ± 2%    47.8ms ± 1%   -8.30%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16        77.9ms ± 1%    70.9ms ± 1%   -9.01%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16      43.0ms ± 0%    37.2ms ± 1%  -13.54%  (p=0.029 n=4+4)
SiteNew/Page_collections-16         58.2ms ± 1%    52.4ms ± 1%   -9.95%  (p=0.029 n=4+4)

name                              old alloc/op   new alloc/op   delta
SiteNew/Bundle_with_image-16        3.81MB ± 0%    2.22MB ± 0%  -41.70%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16    3.60MB ± 0%    2.01MB ± 0%  -44.20%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16      19.3MB ± 1%    14.1MB ± 0%  -26.91%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16            70.7MB ± 0%    69.0MB ± 0%   -2.40%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16        37.1MB ± 0%    31.2MB ± 0%  -15.94%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16      17.6MB ± 0%    10.6MB ± 0%  -39.92%  (p=0.029 n=4+4)
SiteNew/Page_collections-16         25.9MB ± 0%    21.2MB ± 0%  -17.99%  (p=0.029 n=4+4)

name                              old allocs/op  new allocs/op  delta
SiteNew/Bundle_with_image-16         52.3k ± 0%     26.1k ± 0%  -50.18%  (p=0.029 n=4+4)
SiteNew/Bundle_with_JSON_file-16     52.3k ± 0%     26.1k ± 0%  -50.16%  (p=0.029 n=4+4)
SiteNew/Tags_and_categories-16        336k ± 1%      269k ± 0%  -19.90%  (p=0.029 n=4+4)
SiteNew/Canonify_URLs-16              422k ± 0%      395k ± 0%   -6.43%  (p=0.029 n=4+4)
SiteNew/Deep_content_tree-16          401k ± 0%      313k ± 0%  -21.79%  (p=0.029 n=4+4)
SiteNew/Many_HTML_templates-16        247k ± 0%      143k ± 0%  -42.17%  (p=0.029 n=4+4)
SiteNew/Page_collections-16           282k ± 0%      207k ± 0%  -26.55%  (p=0.029 n=4+4)
```

Fixes #6716
Fixes #6760
Fixes #6768
Fixes #6778
2020-01-22 09:39:49 +01:00
hugoreleaser
273047b5ba releaser: Prepare repository for 0.63.0-DEV
[ci skip]
2020-01-05 18:58:55 +00:00
hugoreleaser
12230b6897 releaser: Bump versions for release of 0.62.2
[ci skip]
2020-01-05 18:50:35 +00:00
Bjørn Erik Pedersen
a82d2700fc
markup/goldmark: Make auto IDs GitHub compatible
You can turn off this behaviour:

```toml
[markup]
  [markup.goldmark]
    [markup.goldmark.parser]
      autoHeadingIDAsciiOnly = true
```
Note that the `anchorize` now adapts its behaviour depending on the default Markdown handler.

Fixes #6616
2020-01-04 19:46:01 +01:00
hugoreleaser
ae816452b1 releaser: Prepare repository for 0.63.0-DEV
[ci skip]
2020-01-01 17:46:46 +00:00
hugoreleaser
3a21a1708d releaser: Bump versions for release of 0.62.1
[ci skip]
2020-01-01 17:38:22 +00:00
hugoreleaser
6b59b64f02 releaser: Prepare repository for 0.63.0-DEV
[ci skip]
2019-12-23 10:32:39 +00:00
hugoreleaser
b361d9a462 releaser: Bump versions for release of 0.62.0
[ci skip]
2019-12-23 10:23:27 +00:00
hugoreleaser
186a5ebfca releaser: Prepare repository for 0.62.0-DEV
[ci skip]
2019-12-11 08:35:04 +00:00
hugoreleaser
3af783966d releaser: Bump versions for release of 0.61.0
[ci skip]
2019-12-11 08:26:33 +00:00
hugoreleaser
a6b6b135a4 releaser: Prepare repository for 0.61.0-DEV
[ci skip]
2019-11-29 15:05:19 +00:00
hugoreleaser
6c05563082 releaser: Bump versions for release of 0.60.1
[ci skip]
2019-11-29 14:56:16 +00:00
hugoreleaser
003ba5b10f releaser: Prepare repository for 0.61.0-DEV
[ci skip]
2019-11-27 10:19:00 +00:00
hugoreleaser
763b0dcb97 releaser: Bump versions for release of 0.60.0
[ci skip]
2019-11-27 10:09:46 +00:00
Bjørn Erik Pedersen
a3fe5e5e35
Fix Params case handling in the index, sort and where func
This means that you can now do:

```
{{ range where .Site.Pages "Params.MYPARAM" "foo" }}
```
2019-11-22 18:41:50 +01:00
Bjørn Erik Pedersen
628efd6e29
common/para: Add parallel task executor helper
Usage of this will come later.
2019-11-21 18:38:14 +01:00
Bjørn Erik Pedersen
2dcc1318d1 Add some more output if loading modules takes time
Also include the time to collect modules etc. in the "Total in ..." time reported for the `hugo` command.

Fixes #6519
2019-11-21 18:11:07 +01:00
hugoreleaser
07a203406a releaser: Prepare repository for 0.60.0-DEV
[ci skip]
2019-10-31 15:30:12 +00:00
hugoreleaser
e04a22c5e4 releaser: Bump versions for release of 0.59.1
[ci skip]
2019-10-31 15:20:53 +00:00
Bjørn Erik Pedersen
baa975082c deps: Update to Chroma v0.6.8 to fix a crash
Also improve relevant logging.

Fixes #6450
2019-10-24 11:11:18 +02:00
hugoreleaser
6bcc5ad8b2 releaser: Prepare repository for 0.60.0-DEV
[ci skip]
2019-10-21 09:47:26 +00:00
hugoreleaser
b084af4bfa releaser: Bump versions for release of 0.59.0
[ci skip]
2019-10-21 09:38:50 +00:00
Vazrupe (HyeonGyu Lee)
a9762b5c48 common: Fix elements are doubling when append a not assignable type
Fixes #6188
2019-10-11 10:38:12 +02:00
hugoreleaser
8cb7a0d4db releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-19 15:36:35 +00:00
hugoreleaser
85376a757b releaser: Bump versions for release of 0.58.3
[ci skip]
2019-09-19 15:28:26 +00:00
hugoreleaser
13768c3c50 releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-13 08:12:38 +00:00
hugoreleaser
7bc1270ec7 releaser: Bump versions for release of 0.58.2
[ci skip]
2019-09-13 08:04:20 +00:00
hugoreleaser
77b23fe3db releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-06 09:26:46 +00:00
hugoreleaser
8bc478d3f7 releaser: Bump versions for release of 0.58.1
[ci skip]
2019-09-06 09:18:56 +00:00
hugoreleaser
f4e1cb8d05 releaser: Prepare repository for 0.59.0-DEV
[ci skip]
2019-09-04 15:51:16 +00:00
hugoreleaser
10c0baddfa releaser: Bump versions for release of 0.58.0
[ci skip]
2019-09-04 15:41:58 +00:00
Bjørn Erik Pedersen
f9978ed164
Image resource refactor
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend.

This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below:

    {{ ($myimg | fingerprint ).Width }}

Fixes #5903
Fixes #6234
Fixes #6266
2019-08-26 15:00:44 +02:00
hugoreleaser
3ae4b3e19f releaser: Prepare repository for 0.58.0-DEV
[ci skip]
2019-08-17 17:59:28 +00:00
hugoreleaser
01fbb46354 releaser: Bump versions for release of 0.57.2
[ci skip]
2019-08-17 17:51:54 +00:00
hugoreleaser
36d749f4ea releaser: Prepare repository for 0.58.0-DEV
[ci skip]
2019-08-15 19:00:12 +00:00
hugoreleaser
484106cfa2 releaser: Bump versions for release of 0.57.1
[ci skip]
2019-08-15 18:52:49 +00:00
hugoreleaser
37f5929803 releaser: Prepare repository for 0.58.0-DEV
[ci skip]
2019-08-14 08:13:53 +00:00
hugoreleaser
ab849fcc98 releaser: Bump versions for release of 0.57.0
[ci skip]
2019-08-14 08:05:33 +00:00
Bjørn Erik Pedersen
9e57182705
tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
Christian Muehlhaeuser
e88d798990 Fixed tautological error conditions
Drop error & nil checks where the value can not have changed.
2019-08-10 01:04:43 +02:00
Bjørn Erik Pedersen
7ff0a8ee9f Simplify page tree logic
This is preparation for #6041.

For historic reasons, the code for bulding the section tree and the taxonomies were very much separate.

This works, but makes it hard to extend, maintain, and possibly not so fast as it could be.

This simplification also introduces 3 slightly breaking changes, which I suspect most people will be pleased about. See referenced issues:

This commit also switches the radix tree dependency to a mutable implementation: github.com/armon/go-radix.

Fixes #6154
Fixes #6153
Fixes #6152
2019-08-08 20:13:39 +02:00
hugoreleaser
a4f96a9d8c releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-31 12:56:14 +00:00
hugoreleaser
9433c3c706 releaser: Bump versions for release of 0.56.3
[ci skip]
2019-07-31 12:48:33 +00:00
hugoreleaser
53ade40ba4 releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-30 09:12:29 +00:00
hugoreleaser
2e6da00679 releaser: Bump versions for release of 0.56.2
[ci skip]
2019-07-30 09:05:09 +00:00
Bjørn Erik Pedersen
e393c6290e common/maps: Do not return error on params dot access on incompatible types
This error was introduced in 0.56 and has shown some site breakage in the wild.

Fixes #6121
2019-07-28 13:03:12 +02:00
hugoreleaser
b4827fbb14 releaser: Prepare repository for 0.57.0-DEV
[ci skip]
2019-07-25 16:45:08 +00:00
hugoreleaser
263f86d456 releaser: Bump versions for release of 0.56.0
[ci skip]
2019-07-25 16:37:58 +00:00
Bjørn Erik Pedersen
9f5a92078a
Add Hugo Modules
This commit implements Hugo Modules.

This is a broad subject, but some keywords include:

* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`,  `hugo mod get`,  `hugo mod graph`,  `hugo mod tidy`, and  `hugo mod vendor`.

All of the above is backed by Go Modules.

Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-07-24 09:35:53 +02:00
hugoreleaser
f94a388ad3 releaser: Prepare repository for 0.56.0-DEV
[ci skip]
2019-05-02 13:06:04 +00:00