-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Evaluate post-summary divider HTML shortcodes
In HTML content pages with summary dividers, shortcodes after the summary divider are not evaluated but are simply printed as-is within the .Content of the page. The issue takes place in hugolib.newPageContentOutput. In this function, we apply various transformations to cp.workContent, and at the end of the function, make this assignment: cp.content = helpers.BytesToHTML(cp.workContent) If a page has a manual summary divider and is HTML, we perform this transformation on cp.workContent: cp.workContent = src[cp.p.source.posBodyStart:] While this sets the workContent to all content after the summary divider, it does so *after* newPageContentOutput calls replaceShortcodeTokens and evaluates shortcodes. This means that evaluated shortcodes are replaced with unevaluated ones after the summary divider. The fix is to reuse logic from the function we use to evaluate the summary divider for non-HTML pages, hugolib.splitUserDefinedSummaryAndContent. While the current code branches on whether the page is HTML before calling this function, this change branches within the function, since the function already includes a "markup" parameter we can use to perform the branching. And since this function already splits the summary/content while preserving evaluated shortcodes, we can reuse its splitting logic to fix the issue. Fixes #6513
- Loading branch information
Showing
2 changed files
with
90 additions
and
20 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