hugo/helpers
Bjørn Erik Pedersen 4d26ab33dc
Make .Content (almost) always available in shortcodes
This resolves some surprising behaviour when reading other pages' content from shortcodes. Before this commit, that behaviour was undefined. Note that this has never been an issue from regular templates.

It will still not be possible to get **the current shortcode's  page's rendered content**. That would have impressed Einstein.

The new and well defined rules are:

* `.Page.Content` from a shortcode will be empty. The related `.Page.Truncated` `.Page.Summary`, `.Page.WordCount`, `.Page.ReadingTime`, `.Page.Plain` and `.Page.PlainWords` will also have empty values.
* For _other pages_ (retrieved via `.Page.Site.GetPage`, `.Site.Pages` etc.) the `.Content` is there to use as you please as long as you don't have infinite content recursion in your shortcode/content setup. See below.
* `.Page.TableOfContents` is good to go (but does not support shortcodes in headlines; this is unchanged)

If you get into a situation of infinite recursion, the `.Content` will be empty. Run `hugo -v` for more information.

Fixes #4632
Fixes #4653
Fixes #4655
2018-04-21 22:02:56 +02:00
..
baseURL.go Add some missing doc comments 2017-08-03 15:57:51 +02:00
baseURL_test.go all: Propagate baseURL error to the callers 2017-03-27 15:43:56 +02:00
content.go Make .Content (almost) always available in shortcodes 2018-04-21 22:02:56 +02:00
content_renderer.go helpers: Avoid unescape in highlight 2018-01-23 09:48:04 +01:00
content_renderer_test.go Reuse the BlackFriday instance when possible 2017-12-16 19:44:33 +01:00
content_test.go Implement Page bundling and image handling 2017-12-27 18:44:47 +01:00
docshelper.go docs: Generate docshelper data 2018-04-02 08:52:42 +02:00
emoji.go helpers: Use iterate operator by int in Emojify 2016-11-23 09:13:00 +01:00
emoji_test.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
general.go hugolib: Extract date and slug from filename 2018-03-11 18:26:18 +01:00
general_test.go helpers: Avoid writing the last MD5 buff part twice 2017-12-28 22:52:27 +01:00
hugo.go releaser: Prepare repository for 0.40-DEV 2018-04-16 07:33:49 +00:00
hugo_test.go Properly handle -DEV suffix when comparing Hugo versions 2018-02-22 17:16:42 +01:00
language.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
language_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
path.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
path_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
pathspec.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
pathspec_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
processing_stats.go Run gofmt -s with Go 1.10 2018-02-21 09:59:33 +01:00
pygments.go Add table linenos support for Chroma highlighter 2017-10-14 16:00:27 +02:00
pygments_test.go Add table linenos support for Chroma highlighter 2017-10-14 16:00:27 +02:00
testhelpers_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
url.go Fix URLs for bundle resources in multihost mode 2018-01-06 10:29:13 +01:00
url_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00