Commit graph

7 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 3b4f17bbc9 hugolib: Implement "related content"
This closes #98, even if this commit does not do full content text search.

We may revisit that problem in the future, but that deserves its own issue.

Fixes #98
2017-09-06 00:20:02 +02:00
Bjørn Erik Pedersen 93ca7c9e95 all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.

Updates #2701
Fixes #3016
2017-02-17 17:15:26 +01:00
Bjørn Erik Pedersen c2c73c2bd2 hugolib: Some more GoLint fixes 2016-03-24 14:11:04 +01:00
Bjørn Erik Pedersen 7a5a52f468 Clean up the loop counter variables confusion in TestPageCache
See #1601
2015-12-19 15:38:28 +01:00
Bjørn Erik Pedersen 0c01fef321 Fix 2 data races in TestPageCache
See #1601
2015-12-18 09:35:14 +01:00
Anthony Fok 8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
Bjørn Erik Pedersen a9c5133a77 Fix data races in sorting and Reverse
The custom sort functions used from the templates had some subtle data race- and related issues,
especially when used in the single page template.

This commit fixes this by making copies and protect the read and writes with a RWMutex.

The results are cached (it will typically be invoked *number of pages* times with exactly the same data).

This is, not surprisingly, also faster:

```
benchmark                           old ns/op     new ns/op     delta
BenchmarkSortByWeightAndReverse     14228         491           -96.55%

benchmark                           old allocs     new allocs     delta
BenchmarkSortByWeightAndReverse     1              0              -100.00%

benchmark                           old bytes     new bytes     delta
BenchmarkSortByWeightAndReverse     32            0             -100.00%
```

Fixes #1293
2015-07-23 12:43:57 +02:00