User_profile and status as submenu


on a new site with some private pages, i want to provide the login-status and a link to user_profile as submenu.
thanks to micar’s Topic i already found, where i think the links should be inserted.

i just can not figure out, how to put logout-link and profile-link into the menu structure, to be rendered as submenu from the username since the menu is looped by a macro.

The theme is a child-theme of quark

perhaps someone can provide me an example or a hint

Thanks a lot

Add your HTML-Code to this file, right before the navigation is rendered:


Right above this code:

    {% block header_navigation %}
        {% include 'partials/navigation.html.twig' %}
    {% endblock %}

Then your link appears above the navigation menu.

Hi ,
thank you for your reply!

in that case, the links would not be part of the normal menu (including the burger-menu while on smaller window-sizes)
what i am looking for is , how to include the links as normal submenu, as if it would be a usual part of the menu. including “profile” and “logout” as submenu

hope this description is more clear - sorry for the bad explanation … still fighting with the language anyway :wink:


i found a way - but that seem really ugly to me - especially because i had to add the login-part of the meu into navigation.html.twig :

   <ul {{ tree ? 'class="tree"' : '' }}>
    {{ macros.nav_loop(pages) }}
  {% if grav.user.authenticated %}

    <a href="{{ base_url }}/profile" class="{{ active_page }}" class="login-status">
     <i class="fa fa-user"></i> {{ grav.user.fullname ?: grav.user.username }}
        <a href="{{ base_url }}/profile" class="{{ active_page }}">
        <a class="logout" href="{{ uri.addNonce((base_url_relative ~ uri.path)|trim('/') ~ 
 '/task' ~ config.system.param_sep ~ 'login.logout', 
    'logout-form', 'logout-nonce')|e }}">
    {{ 'PLUGIN_LOGIN.BTN_LOGOUT'|t }}</a>

{% endif %} 

or does it look ok to you?

1 Like

Looks OK to me :slight_smile:

Thank you,

i thought it might be a bad style to customise too many files, that normally belong to the parent theme and might change on updated versions.
So if it is not, I will keep it that way :wink:

If it is in a parent theme, then it will be overwritten with updates.

@odde, Just for clarification and preventing future disappointments…

You should not edit files in the original theme, but only in a child/inherited theme you create yourself.

You mention you are using a child-theme of Quark, I presume you have created a child-theme of Quark yourself and not downloaded a theme based on Quark? If so, skip step 1 below.

  1. If not already, create an inherited theme to prevent loss of changes when original theme gets updated. See docs Theme Inheritance step 1-5.
    Let’s assume the inherited theme is called ‘mytheme’.
  2. Copy file ‘user/themes/quark/templates/partials/navigation.html.twig’ into your own theme’s folder 'user/themes/mytheme/templates/partials/`.
  3. Add your code to this copied file.

hi pamtbaau,
thank you for the hint!

yep - I created the child theme, when I had to edit the very first twig to keep my edits save from updates.
nevertheless do I try to customise as few as possible files - that I therefore have to save in my own theme.
Since I try to keep my grav,plugins and themes up to date I hope hope to avoid any trouble with keeping my edits as small and rare as possible :wink:

Thank you