hugo/tpl
Bjørn Erik Pedersen 90da7664bf Add page fragments support to Related
The main topic of this commit is that you can now index fragments (content heading identifiers) when calling `.Related`.

You can do this by:

* Configure one or more indices with type `fragments`
* The name of those index configurations maps to an (optional) front matter slice with fragment references. This allows you to link
page<->fragment and page<->page.
* This also will index all the fragments (heading identifiers) of the pages.

It's also possible to use type `fragments` indices in shortcode, e.g.:

```
{{ $related := site.RegularPages.Related .Page }}
```

But, and this is important, you need to include the shortcode using the `{{<` delimiter. Not doing so will create infinite loops and timeouts.

This commit also:

* Adds two new methods to Page: Fragments (can also be used to build ToC) and HeadingsFiltered (this is only used in Related Content with
index type `fragments` and `enableFilter` set to true.
* Consolidates all `.Related*` methods into one, which takes either a `Page` or an options map as its only argument.
* Add `context.Context` to all of the content related Page API. Turns out it wasn't strictly needed for this particular feature, but it will
soon become usefil, e.g. in #9339.

Closes #10711
Updates #9339
Updates #10725
2023-02-21 17:56:41 +01:00
..
cast tpl: Improve godoc 2022-05-06 19:43:22 +02:00
collections tpl/collections: Improve error message in Index 2023-02-08 10:22:20 +01:00
compare tpl/compare: Sort special float values as string 2023-01-02 17:35:08 +01:00
crypto tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
data tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
debug tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
diagrams Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
encoding tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
fmt tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
hugo all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
images Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
inflect tpl: Improve template funcs GoDoc 2022-12-21 15:33:02 +01:00
internal Add page fragments support to Related 2023-02-21 17:56:41 +01:00
js all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
lang Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
math tpl: Use consistent delimiter spacing in examples 2022-11-25 09:54:35 +01:00
openapi Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
os Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
partials Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
path Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
reflect all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
resources Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
safe tpl: Improve godoc 2022-05-06 19:43:22 +02:00
site all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
strings tpl/strings: Add strings.ContainsNonSpace 2023-02-05 20:08:44 +01:00
templates all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
time Use configured timeZone for the clock 2022-05-08 16:56:26 +02:00
tplimpl Revert "tpl/tplimpl: Use https in sitemap templates" 2022-12-22 08:53:58 +01:00
transform Add page fragments support to Related 2023-02-21 17:56:41 +01:00
urls Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
template.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
template_info.go Add --printUnusedTemplates 2022-02-15 20:01:57 +01:00
template_test.go Fix Plainify edge cases 2022-05-25 17:55:23 +02:00