I see this is a difficult task now to do and its not possible with markdownify
The Condition is to use {{.Content}} , to enable shortcode , it needed to be a PAGE
I hope other people might find my solution quite helpful.
Especially For Someone who likes to build page builder…
// index.html for homepage
{{ define "main" }}
{{if .IsHome}}
{{$sections := .Page.Params.sections }}
{{$sc := len $sections }}
{{if gt $sc 0}}
{{- range $sections -}}
{{ $params := merge (dict "Site" $.Site) . }}
{{- partial .template $params -}}
{{ if (and ( (isset .video "id") ) ( not (eq .video.id "" )) ) }}
{{- partial "modal" .video -}}
{{end}}
{{- end -}}
{{end}}
{{end}}
{{end}}
As You can see on that code Ive Passed the Site as $.Site
That is needed later in any template, but this Template is not normal
It is a Headless Bundle , you can read more here
So Ive Create home/contents folder under content
inside home/contents ive created _index.md
with this content
---
index: true
draft: false
_build:
list: false
render: false
cascade:
_build:
render: false
list: true
---
This is HomePage Contents , This Body Wont be Used
Now I can create a New Page for example inside content/home/contents
example.md
---
index: false
order: 0
title: Example
---
Faucibus commodo massa rhoncus, volutpat. Dignissim sed eget risus enim. Mattis mauris semper sed amet vitae sed turpis id. Id dolor praesent donec est. Odio penatibus risus viverra tellus varius sit neque erat velit.
{{< youtube hsm4poTWjMs >}}
As You can See There is a shortcode there and that Would be Render HOW?
So Inside a TEMPLATE , any partials im loading dynamically I just added this
<article class="prose prose-2xl mx-auto px-5 sm:px-0">
{{with .intro}}<p class="text-2xl text-center leading-6 text-brand font-semibold tracking-wide uppercase">{{.}}</p>{{end}}
{{with .title}}<h1 class="mt-2 mb-8 text-3xl text-center leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10">{{.}}</h1>{{end}}
{{with .summary}}<p class="lead">{{.}}</p>{{end}}
{{ with .Site.GetPage "home/contents/example" }}{{ .Content }}{{ end }}
</article>
As You Can See m Referencing the .Site Variable Ive Passed To Each Template
Now It Rendered the shortcode since Im on the Context of a Page and Adding {{.Content}} is now possible and is Inside the Page Scope.
Last Part is to Add a New Folder Collection to Netlify CMS for home contents.
Which can the user can choose … Yeah Im still not on that part , havent tried it ,
but i think that is possible with the relation widget…
But that is my solution to render shortcode in a dynamic template…
It may or may not fit your Use case but mine , I only need it on Home Page
Where I dont know where the user would place it, it can be at the start , middle or end…