Log out issue (Front end user)

When I navigate to a private page, i am shown the login form as i would expect, this then shows me a login status in my nav (code below) once logged in

The button i am presented with states log out but it does not work, I do not know how to fix this can anyone help?

how can i log out a front end user?

i have inserted this code into my nav bar
{% if grav.user.username %}

  • {% include ‘partials/login-status.html.twig’ %}

  • {% endif %}

    which will load this from the login plugin

    {% if grav.user.authenticated %}
    {{ grav.user.fullname ?: grav.user.username }}, {{ ‘PLUGIN_LOGIN.BTN_LOGOUT’|t }}
    {% endif %}

    and on my page i added
    site.ambassador: true
    visibility_requires_access: true

    on further checking there is no href value on the link


    very weird, i changed themes it gave me a link on the href, it seems to be if i place it in the base template it works in my include nav templete it fails, it doesnt recognise config.plugins.login.enabled

    OK finally found the fix / issue

    {% if config.plugins.login.enabled and grav.user.username %}

    i was using this code to access the status and I placed this within the nav_loop macro and it would return config.plugins.login.enabled as null

    once removed from the macro and placed outside of this loop the config.plugins.login.enabled is accessible