forked from gohugoio/hugo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure page translation CPs are initialized
PR gohugoio#9342 introduced a regression in which calling .Translations in a template and calling RenderString on a translated Page caused a nil pointer dereference. The issue was that some Pages returned from .Translations had a nil cp field at the time the calling template was being executed. While PR gohugoio#9342 had attempted to ensure that all ContentProviders were initialized for translations at build time, it only performed the initialization for receivers of ContentProvider methods such as .Summary. However, the ContentProvider's *pageState.pageOutput.cp would remain uninitialized, causing the nil pointer dereference. This change edits the .Translations and .AllTranslations methods to ensure that all of a page's translations have an initialized content provider in time for a template to be executed. Since LazyContentProvider is no longer needed with this approach, this change also reverts the following commits: - cdcd15b - 25d645f Fixes gohugoio#9383
- Loading branch information
Showing
3 changed files
with
101 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.