Accessing page.content that contains liquid statements

Let’s say I have a Javascript file with code similar to the following. And note that this is an edited and truncated version of what’s in lunr.store.js, so I hope I’m not violating any rules by posting it:

var store = [
  {%- for c in site.collections -%}
    {%- for doc in c.docs -%}
      {
        ...
        "excerpt":
          {{ doc.content ...

If the .md file that doc references has Liquid statements in it, those statements aren’t expanded yet. In other words doc.content will return the liquid statements instead of what they eventually become when the html file for that page is produced.

I hope that makes sense.

Is there a way I can get the version of doc.content (i.e. page.content) that has the Liquid statements already evaluated/expanded/whatever?

Sheesh, I hope this makes sense. Thanks in advance.

Does that JS file have front matter? it is required in order to be rendered. Sounds like it does cause it is really the doc file that is not rendered. Does that file have front matter? You may need to run the JS file thru a layout?

You might want to post more info - like a link to repo with a minimal example.

Thanks for the reply. And thanks for asking for more information, because as I was trying to explain what was going on, I realized I was making some assumptions, and they turned out to be wrong.

So thanks for making me think more. :slight_smile: Of course, I might still end up coming back with another issue, but at least for now, I’m good. Thanks!