hugo/common
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
..
collections Add page fragments support to Related 2023-02-21 17:56:41 +01:00
constants Allow getJSON errors to be ignored 2020-10-22 09:09:29 +02:00
herrors Also consider wrapped errors when checking for file IsNotExist errors 2022-12-14 13:51:06 +01:00
hexec all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
hreflect Fix raw TOML dates in where/eq 2022-06-07 13:02:58 +02:00
htime Fix raw TOML dates in where/eq 2022-06-07 13:02:58 +02:00
hugio common/hugio: Fix multiWriteCloser.Close 2022-12-06 10:32:33 +01:00
hugo releaser: Prepare repository for 0.111.0-DEV 2023-01-17 12:28:17 +00:00
loggers Respect NO_COLOR 2022-06-13 18:07:37 +02:00
maps Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
math all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
para para: Skip para test when not on CI 2020-12-23 19:47:20 +01:00
paths Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
terminal Respect NO_COLOR 2022-06-13 18:07:37 +02:00
text Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
types resources: Create a common ResourceFinder interface 2022-04-05 18:00:44 +02:00
urls all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
docs.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00