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.

Support

Upgrade to Grav 1.7.46 causes problem with SimpleSearch plugin

plugins

Solved by JD View solution

Started by JD 2 years ago · 4 replies · 237 views
2 years ago

I'm using the simplesearch plugin (v2.3.0) to create a filtered collection to be shown in a list, using children.html.twig. Theme used: Hypertext.

All worked fine with Grav 1.7.45. After upgrading to 1.7.46, it seems that the search result that is expected by children.html.twig in {% if search_results %} is empty, so it returns the full collection. Also, the search field isn't shown at the results page, which should be the case. There are no errors shown in the Grav log, nor in the Apache log.

I could narrow it down to upgrading Grav causing this phenomenon. No plugin update did cause any problem. Tried several times, in different sequences. Also reinstalled the simplesearch plugin.
I Did a compare at github: grav/compare/1.7.45...1.7.46. But I can't see any change between those versions that could have to do with this specific problem.

In which direction should I investigate further to find a cause?

last edited 05/29/24 by JD
2 years ago

@Yannnd, I cannot reproduce the issue using Blog Skeleton with Grav 1.7.46

How you could do some self-help:

  • My setup:
    Installed and enabled theme Hypertext + added {% include 'partials/simplesearch_searchbox.html.twig' %} and {% include 'simplesearch_results.html.twig' %} to user/themes/hypertext/templates/partials/base.html.twig
  • Initial search: No results
  • Checked the devtools of the browser => no javascript files loaded
  • Searching where assets are being loaded
  • In /user/themes/hypertext/templates/partials/page/js-css.html.twig, I added the following dumps after line 6:

    TWIG
    {% set allowJS  = page.header.allowJS  == 'enabled' or
                    (page.header.allowJS|default('default') == 'default' and 
                     style.allowJS == '1') %}
    
    {{ dump(allowJS) }}                                 => false
    {{ dump(page.header.allowJS) }}                     => null
    {{ dump(page.header.allowJS|default('default')) }}  => default
    {{ dump(style) }}                                   => array[...]
    {{ dump(style.allowJS) }}                           => false
    
  • Had a look at the default config file user/themes/hypertext/hypertext.yaml: style.allowJs: false
  • Switched to true => Javascript is loaded, all is working fine
  • Went to github of Hypertext and open file hypertext.yaml and then click History.

Question:

  • Did you perhaps also upgrade HyperText and has it been a loooong time ago you installed/upgraded it?
  • What is the content of:
    • /user/env/\<yourdomain>/config/themes/hypertext.yaml
    • /user/\<yourdomain>/config/themes/hypertext.yaml
    • /user/config/themes/hypertext.yaml
    • /user/themes/hypertext/hypertext.yaml
2 years ago

Hi @pamtbaau,

thank you very much for your elaborate answer and the efforts you made to reproduce my problem. Now I've got some homework to do 🙂. I will report back a.s.a.p. what I will find!

👍 1
2 years ago

I'm still investigating. The 'allowJS' settings are all ok, it's a known pitfall when using the Hypertext theme.

I'll report back when I find something!

2 years ago Solution

Finally it became clear that one setting wasn't well chosen. In the Admin plugin: Configuration → System → Content → Home page did not point to /home.
(setting home: in /user/config/system.yaml)
Corrected this and the problem was solved.

Thanks to @pamtbaau for pointing me at that setting.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 56 13 hours ago
Support · by Anna, 3 days ago
2 61 16 hours ago
Support · by Justin Young, 17 hours ago
1 32 17 hours ago
Support · by Duc , 1 week ago
2 66 5 days ago
Support · by Colin Hume, 1 week ago
2 59 5 days ago