Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Search plugins on a 'dynamic' Grav site

Started by Shane 7 years ago · 6 replies · 969 views
7 years ago

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:

TWIG
 {% 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.

7 years ago

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.

7 years ago

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.

7 years ago

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.

7 years ago

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.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 49 1 week ago
Plugins · by Xavier, 4 weeks ago
2 57 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1184 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 75 2 months ago