hugo/resources
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
..
images Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
internal Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
jsconfig all: Format code with gofumpt 2020-12-03 13:12:58 +01:00
page Add page fragments support to Related 2023-02-21 17:56:41 +01:00
postpub Add page fragments support to Related 2023-02-21 17:56:41 +01:00
resource Add page fragments support to Related 2023-02-21 17:56:41 +01:00
resource_factories Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
resource_transformers Add page fragments support to Related 2023-02-21 17:56:41 +01:00
testdata deps: Upgrade github.com/bep/gowebp v0.1.0 => v0.2.0 2022-11-15 18:19:35 +01:00
docs.go Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
errorResource.go Add page fragments support to Related 2023-02-21 17:56:41 +01:00
image.go Only invoke a given cached partial once 2023-01-25 17:35:23 +01:00
image_cache.go Fix MediaType when reading images from cache 2022-04-16 16:36:15 +02:00
image_extended_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
image_test.go Add page fragments support to Related 2023-02-21 17:56:41 +01:00
integration_test.go resources: Improve error message on .Resize etc. on SVGs 2022-05-25 18:06:20 +02:00
post_publish.go Add basic "post resource publish support" 2020-04-07 21:59:20 +02:00
resource.go Add page fragments support to Related 2023-02-21 17:56:41 +01:00
resource_cache.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
resource_cache_test.go Improve the server assets cache invalidation logic 2019-08-13 18:09:46 +02:00
resource_metadata.go Improve error messages, esp. when the server is running 2022-05-06 19:43:22 +02:00
resource_metadata_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
resource_spec.go Add fill HTTP Response info into .Data in resources.GetRemote 2023-01-16 14:44:15 +01:00
resource_test.go all: gofmt -w -r 'interface{} -> any' . 2022-03-17 22:03:27 +01:00
testhelpers_test.go Some godoc adjustments and image struct renames 2022-04-27 23:53:56 +02:00
transform.go Add page fragments support to Related 2023-02-21 17:56:41 +01:00
transform_test.go Add page fragments support to Related 2023-02-21 17:56:41 +01:00