From f55ff594c0f63899a8af893f33bd62ceb77cc8fd Mon Sep 17 00:00:00 2001 From: Federico Agostini <43784886+Agos95@users.noreply.github.com> Date: Mon, 13 Feb 2023 21:03:01 +0100 Subject: [PATCH] fix: shortcode context for v2 blocks (#2919) Shortcodes in the new block system do not get access to the correct .Page variable (see #2918 ). The problem is the use of markdownify function to parse $block.content.text, since it actually is an alias to site.Home.RenderString since v 0.93.0 (see gohugoio/hugo#9959 (comment)). This causes the shortcodes to always get the Homepage as .Page variable. The fix is to substitute markdownify with $page.RenderString, which gives the correct context. Fixes #2918 --- modules/wowchemy/layouts/partials/blocks/about.avatar.html | 2 +- modules/wowchemy/layouts/partials/blocks/accomplishments.html | 2 +- modules/wowchemy/layouts/partials/blocks/collection.html | 2 +- modules/wowchemy/layouts/partials/blocks/contact.html | 2 +- modules/wowchemy/layouts/partials/blocks/experience.html | 2 +- modules/wowchemy/layouts/partials/blocks/features.html | 2 +- modules/wowchemy/layouts/partials/blocks/hero.html | 2 +- modules/wowchemy/layouts/partials/blocks/markdown.html | 2 +- modules/wowchemy/layouts/partials/blocks/portfolio.html | 2 +- modules/wowchemy/layouts/partials/blocks/tag_cloud.html | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/wowchemy/layouts/partials/blocks/about.avatar.html b/modules/wowchemy/layouts/partials/blocks/about.avatar.html index f43c3228..ee554fdb 100644 --- a/modules/wowchemy/layouts/partials/blocks/about.avatar.html +++ b/modules/wowchemy/layouts/partials/blocks/about.avatar.html @@ -82,7 +82,7 @@ {{ end }} - {{ with ($block.content.text | emojify | markdownify) | default $person_page.Content }} + {{ with ($block.content.text | emojify | $page.RenderString) | default $person_page.Content }}