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

Lost functionality after upgrading grav & changing from apache to nginx

Started by Muut Archive 10 years ago · 4 replies · 659 views
10 years ago

I changed from apache to nginx today, and after a few hickups I can see the site just fine.
At the same time there was a grav version update, from 1.1.8 to 1.1.9 iirc.

Now the comments and simplesearch plugins are not working anymore and I'm having a hard time troubleshooting: no log entries, no errors.

the comments don't show up at all where I reserved a place for them in theme/templates/item.html.twig:

TWIG
<div id="item" class="block pure-u-2-3">
{% include 'partials/blog_item.html.twig' with {'blog':page.parent, 'truncate':false } %}
{% include 'partials/comments.html.twig' with {'page': page} %}
</div>

partials/comments.html.twig is being evaluated, and if i remove this if-clause:

TWIG
{% if grav.twig.enable_comments_plugin %}

i can at least see the form, but nothing is submitted, not on the page, not to my email.

the simplesearch plugin is doing equally strange things:
i can enter /search/query:somequery manually, and get results for somequery, but i cannot use the simplesearch_searchbox.html.twig to submit searches. javascript IS enabled.

thanks for reading, I hope there's a solution to this.

10 years ago

I just tried downloading a fresh "Blog Site" skeleton, and installed the Comments plugin. The comments form shows up correctly, you might want to compare how the Antimatter theme loads it?

10 years ago

you mean under nginx?
the behavior is the same for antimatter and my custom theme.
actually the searchplugin has "caught itself" and is working again.

but not the comments.

i have added 2 lines to comments.html.twig for debugging:

HTML
<p>first test</p>
{% if grav.twig.enable_comments_plugin %}
<p>second test</p>

i can see "first test" on the page, but not "second test".
there are no errors in the logs.
the debug bar shows this for plugins - comments:

JS
array:4 [
  "enabled" => true
  "enable_on_routes" => array:1 [ 
    0 => "/blog"
  ]
  "disable_on_routes" => array:1 [
    0 => "/contact"
  ]
  "form" => array:4 [
    "name" => "comments"
    "fields" => array:7 [
      0 => array:6 [
        "name" => "name"
        "label" => "Name"
        "placeholder" => "Enter your name"
        "autocomplete" => "on"
        "type" => "text"
        "validate" => array:1 [
          "required" => true
        ]
      ]
      1 => array:5 [
        "name" => "email"
        "label" => "Email"
        "placeholder" => "Enter your email address"
        "type" => "email"
        "validate" => array:1 [
          "required" => true
        ]
      ]
      2 => array:5 [
        "name" => "text"
        "label" => "Message"
        "placeholder" => "Enter your message"
        "type" => "textarea"
        "validate" => array:1 [
          "required" => true
        ]
      ]
      3 => array:3 [
        "name" => "date"
        "type" => "hidden"
        "process" => array:1 [
          "fillWithCurrentDateTime" => true
        ]
      ]
      4 => array:3 [
        "name" => "title"
        "type" => "hidden"
        "evaluateDefault" => "grav.page.header.title"
      ]
      5 => array:3 [
        "name" => "lang"
        "type" => "hidden"
        "evaluateDefault" => "grav.language.getLanguage"
      ]
      6 => array:3 [
        "name" => "path"
        "type" => "hidden"
        "evaluateDefault" => "grav.uri.path"
      ]
    ]
    "buttons" => array:1 [
      0 => array:2 [
        "type" => "submit"
        "value" => "Submit"
      ]
    ]
    "process" => array:3 [
      0 => array:1 [
        "email" => array:4 [
          "subject" => "[New Comment] from {{ form.value.name|e }}"
          "body" => "{% include 'forms/data.html.twig' %}"
          "to" => "xxxxxxxxxxxxxxxx"
          "from" => "xxxxxxxxxxxxxxxxxxxx"
        ]
      ]
      1 => array:1 [
        "addComment" => null
      ]
      2 => array:1 [
        "message" => "Thank you for writing your comment!"
      ]
    ]
  ]
]

here's a list of installed plugins:

TXT
archives/
comments/
count-views/
email/
error/
featherlight/
feed/
form/
page-inject/
pagination/
precache/
private/
problems/
random/
readingtime/
simple_contact/
simplesearch/
sitemap/
tagcloud/
taxonomylist/
toc/

maybe one of those is causing trouble?

10 years ago

ok, i got it.
it seems the comments plugin is interpreting the enable_on_routes variable differently now.
i always had it as

TXT
enable_on_routes:
  - '/blog'

(this is still the default currently)

changing it to

TXT
enable_on_routes:
  - '/'

makes the comments re-appear :-)

my interpretation:
in my system.yaml, i'm telling grav to hide the '/blog' route in urls.
it would seem that after the grav update, this is also internally applied to the twig environment?
am i correct?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1350 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2947 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago