Perhaps I’m using Grav in a unique way, but all my content is generated from yaml files. So my typical page content is nothing more than code like this:
{% for item in page.header.imports %}
{% if item.Chapter == 1 %}
Génesis {{ item.Chapter }}:{{ item.Verse }} {{ item.Context }}</br>
{% endif %}
{% endfor %}
This is making search capabilities difficult. I have two search plugins being used. TNTSearch. This works on a currently rendered page, but that is it. SimpleSearch plugin has an option to search the ‘rendered page’. I’m not able to get either of these working. So basically, I need Grav to render the page, and then for SimpleSearch to render the search. In theory, it should be able to search the cache as well. I don’t have dynamic content that is changing. I just didn’t want to code thousands of pages of content, that is why I’m pulling it from a yaml file. Any ideas on making either of these search plugins usable in my scenario, would greatly be appreciated.
Your cache is not filled with rendered pages? If so, search the cache?
If not, the search function only searches through files in /user/pages/*/. I suspect the files searched are the yaml meta files, as well as default.md.
I think my cache is filled with the rendered pages… I’m not sure how to search the cache. And you are correct, the TNTSearch indexed very quickly a bunch of useless metadata, that is not actually the page content. My default pages are very few, and very little useful content.
I’m using that plugin too, but it doesn’t seem to work either. There is an option to search ‘rendered’ pages instead of the md data, but even with that selected, it doesn’t search the actual content of the pages that is generated from the yaml files.
You can probably write your own plugin that does this. Possibly take the yaml files, and writes them out to markdown. When input changes, they should be overwritten with the new input.
I don’t think I’m able to write a plugin. I’m really just a hacker that can make things work, not a coder. I think I understand what you are saying, and it does sound like a possibility. Basically, the plugin would read the code, interpret it to md, and then effectively write that as a md file. When the yaml data file is edited, then it would update itself, and overwrite the md file. I have no idea how to make that work.
Thanks for the input. You can see the site running here: www.biblia.reinavaleragomez.com It is live. I run the trial and error stuff on my desktop.