Stay on the same page after logout
Yep, postLogoutRedirect can be set to a function instead of a static value. So for example, in your template you can generate a hidden field in your logout form (or append a querystring parameter to the logout URL) that contains the path of the current page. Then set this in your general.php:
'postLogoutRedirect' =&gt; function($siteHandle) {
  return Craft::$app-&gt;request-&gt;getParam('myLogoutPathParameterName', '/');
}

This defaults to the homepage ('/') if the parameter is not found.