I’m trying to add site search using Lunr and so, generating index like this:
{{ $.Scratch.Add "pagesIndex" slice }}
{{ range $index, $page := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $pageData := (dict "title" $page.Title "href" $page.RelPermalink "tags" (delimit $page.Params.tags " ; ") "content" $page.Plain) }}
{{ $.Scratch.Add "pagesIndex" $pageData }}
{{ end }}
{{ $.Scratch.Get "pagesIndex" | jsonify }}
The problem is, the generated JSON also includes the <script> tags that I used in my shortcodes.
For example, in my video shortcode, I have used Plyr.io as my video player and so, I’m initializing the player using (while the loadMedia function exists in my script that exists in my document’s <head>):
<script>
document.addEventListener("turbolinks:load", function()
{
loadMedia();
});
</script>
The generated JSON also includes the text document.addEventListener("turbolinks:load", function(){loadMedia();});.
Is there any way I can exclude text content from my shortcodes while including the text that I’ve written in markdown?