mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 16:15:12 +00:00
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
This commit is contained in:
1 parent
b9752d697a
commit
f55ff594c0
10 files changed
+10
-10
No files matched your search
@@ -82,7 +82,7 @@
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ with ($block.content.text | emojify | markdownify) | default $person_page.Content }}
|
||||
{{ with ($block.content.text | emojify | $page.RenderString) | default $person_page.Content }}
|
||||
<div class="article-style pt-2 d-flex justify-content-center">
|
||||
<div class="bio-text">
|
||||
{{ . }}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<!-- Accomplishments widget -->
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
{{ with $block.Content }}{{ . }}{{ end }}
|
||||
{{ with $block.content.text }}{{ . | emojify | $page.RenderString }}{{ end }}
|
||||
|
||||
{{ if $block.content.items }}
|
||||
{{ range $idx, $key := sort $block.content.items ".date_start" "desc" }}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
|
||||
{{ with $block.content.text }}{{ . | emojify | markdownify }}{{ end }}
|
||||
{{ with $block.content.text }}{{ . | emojify | $page.RenderString }}{{ end }}
|
||||
|
||||
{{ range $index, $item := $query }}
|
||||
{{ partial "functions/render_view" (dict "page" $block "item" . "view" ($block.design.view | default "compact") "index" $index) }}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{{ end }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
{{ with $block.content.text }}{{ . }}{{ end }}
|
||||
{{ with $block.content.text }}{{ . | emojify | $page.RenderString }}{{ end }}
|
||||
|
||||
{{ if $use_form }}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<!-- Experience widget -->
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
{{ with $block.content.text }}{{ . | emojify | markdownify }}{{ end }}
|
||||
{{ with $block.content.text }}{{ . | emojify | $page.RenderString }}{{ end }}
|
||||
|
||||
{{ if $block.content.items }}
|
||||
{{ $exp_len := len $block.content.items }}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
{{ with $block.content.text }}
|
||||
<div class="col-md-12">
|
||||
{{ . | emojify | markdownify }}
|
||||
{{ . | emojify | $page.RenderString }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{{ end }}
|
||||
|
||||
{{ with $block.content.text }}
|
||||
<div class="hero-lead">{{ . | markdownify | emojify }}</div>
|
||||
<div class="hero-lead">{{ . | $page.RenderString | emojify }}</div>
|
||||
{{ end }}
|
||||
|
||||
{{/* Call-to-action link */}}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{{ $page := .wcPage }}
|
||||
{{ $block := .wcBlock }}
|
||||
{{ $columns := $block.design.columns | default "1" }}
|
||||
{{ $text := $block.content.text | emojify | markdownify }}
|
||||
{{ $text := $block.content.text | emojify | $page.RenderString }}
|
||||
|
||||
{{ if ne $columns "1" }}
|
||||
<div class="col-12 col-lg-8">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
||||
|
||||
{{ with $block.content.text }}{{ . | markdownify }}{{ end }}
|
||||
{{ with $block.content.text }}{{ . | $page.RenderString | emojify }}{{ end }}
|
||||
|
||||
{{ if $block.content.buttons }}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
{{ $columns := $block.design.columns | default "1" }}
|
||||
|
||||
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{else}}text-center{{end}}">
|
||||
{{ with $block.content.text }}{{ . | markdownify }}{{ end }}
|
||||
{{ with $block.content.text }}{{ . | $page.RenderString | emojify }}{{ end }}
|
||||
|
||||
{{ if ne $count 0 }}
|
||||
|
||||
|
||||
Reference in new issue
Block a user