Landio theme: Login link removal - Login Plugin

My website (made with landio) should not offer any possibilty for an external user login.
How can I remove the “Login” link on the top right?

If i deactivate the login plugin the admin plugin is not working anymore…

Thanks and greetings,
Matthias

Hi @beginners_mind, I had a quick look at this theme and it seems that there is not an option to hide that “login” link.

However, you could do this by setting up an inherited theme (https://learn.getgrav.org/16/themes/customization#theme-inheritance) and then editing the Twig file that is used for the display of the Navigation menu (navigation.html.twig).

As a quick test/demo, you could replace the contents of the file (/user/themes/landio/templates/partials/navigation.html.twig) with this text - where I have ‘commented-out’ the placement of the Login link:

<nav class="navbar {% if page.header.navbar_class %}{{ page.header.navbar_class }}{% else %}navbar-dark bg-inverse bg-inverse-custom navbar-fixed-top{% endif %}">
    <div class="container">
        <a class="navbar-brand" href="{% if not site.logo.url %}{{ base_url_absolute }}{% else %}{{ site.logo.url }}{% endif %}">
            {% if site.logo.icon %}<span class="icon-{{ site.logo.icon }}"></span>{% endif %}
            {% if site.logo.text %}<span class="sr-only">{{ site.logo.text }}</span>{% endif %}
        </a>
        <a class="navbar-toggler hidden-md-up pull-right" data-toggle="collapse" href="#collapsingNavbar" aria-expanded="false" aria-controls="collapsingNavbar">
            &#9776;
        </a>
        <a class="navbar-toggler navbar-toggler-custom hidden-md-up pull-right" data-toggle="collapse" href="#collapsingMobileUser" aria-expanded="false" aria-controls="collapsingMobileUser">
            <span class="icon-user"></span>
        </a>
        <div id="collapsingNavbar" class="collapse navbar-toggleable-custom" role="tabpanel" aria-labelledby="collapsingNavbar">
            <ul class="nav navbar-nav pull-right">
                {% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %}
                {% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
                {% for page in pages.children %}
                {% if page.visible %}
                {% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
                <li class="nav-item nav-item-toggable {{ current_page }}">
                    <a class="nav-link" href="{{ page.url }}">
                        {{ page.menu }}<span class="sr-only">(current)</span>
                    </a>
                </li>
                {% endif %}
                {% endfor %}
                {% for mitem in site.menu %}
                <li class="nav-item nav-item-toggable">
                    <a class="nav-link" href="{{ mitem.link }}">{{ mitem.text }}</a>
                </li>
                {% endfor %}
                {% for module in page.collection() %}
                {% if not module.header.hidemenu %}
                {% set current_page = (module.active or module.activeChild) ? 'current' : '' %}
                <li class="nav-item nav-item-toggable {{ current_module }}">
                    <a class="nav-link" href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a>
                </li>
                {% endif %}
                {% endfor %}

                {% if config.plugins.simplesearch.enabled %}
                <li class="nav-item nav-item-toggable hidden-sm-up">
                    <form class="navbar-form">
                        {% include 'partials/simplesearch_searchbox.html.twig' %}
                    </form>
                </li>
                <li class="navbar-divider hidden-sm-down"></li>
                <li class="nav-item dropdown nav-dropdown-search hidden-sm-down">
                    <a class="nav-link dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <span class="icon-search"></span>
                    </a>
                    <div class="dropdown-menu dropdown-menu-right dropdown-menu-search" aria-labelledby="dropdownMenu1">
                        <form class="navbar-form">
                            {% set form2 = true %}
                            {% include 'partials/simplesearch_searchbox.html.twig' %}
                        </form>
                    </div>
                </li>
                {% endif %}
                {#
                {% if config.plugins.login.enabled %}
                {% if grav.user.username %}
                <li class="nav-item dropdown hidden-sm-down textselect-off">
                    {% if grav.user.email %}
                        <a class="nav-link dropdown-toggle nav-dropdown-user" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <img src="http://www.gravatar.com/avatar/{{ grav.user.email|md5 }}?s=40" class="img-circle" alt="Gravatar"/><span class="icon-caret-down"></span>
                        </a>
                    {% endif %}
                    <div class="dropdown-menu dropdown-menu-right dropdown-menu-user dropdown-menu-animated" aria-labelledby="dropdownMenu2">
                        <div class="media">
                        {% if grav.user.email %}
                        <div class="media-left">
                            <img src="http://www.gravatar.com/avatar/{{ grav.user.email|md5 }}?s=60" class="img-circle" alt="Gravatar"/>
                        </div>
                        {% endif %}
                            {% if grav.user.fullname or grav.user.email %}
                            <div class="media-body media-middle">
                                {% if grav.user.fullname %}
                                <h5 class="media-heading">{{ grav.user.fullname }}</h5>
                                {% endif %}
                                {% if grav.user.email %}
                                <h6>{{ grav.user.email }}</h6>
                                {% endif %}
                            </div>
                            {% endif %}
                        </div>
                        <a href="{{ base_url_absolute }}/admin/pages" class="dropdown-item text-uppercase">Manage pages</a>
                        <a href="{{ base_url_absolute }}/admin/system" class="dropdown-item text-uppercase">Configuration</a>
                        <a href="{{ base_url_absolute }}/admin/themes" class="dropdown-item text-uppercase">Installed themes</a>
                        {% for item in site.userlinks %}
                            <a href="{{ item.url }}" class="dropdown-item text-uppercase">{{ item.text }}</a>
                        {% endfor %}
                        <a href="{{ uri.url }}/task:login.logout" class="dropdown-item text-uppercase text-muted">Log out</a>
                        <a href="{{ base_url_absolute }}/admin/users/{{ grav.user.username }}" class="btn-circle has-gradient pull-right">
                            <span class="sr-only">Edit</span>
                            <span class="icon-edit"></span>
                        </a>
                    </div>
                </li>
                {% else %}
                <li class="nav-item nav-item-toggable ">
                    <a class="nav-link" href="login">
                        {{ 'PLUGIN_LOGIN.BTN_LOGIN'|t }}
                    </a>
                </li>
                {% endif %}
                {% endif %}
                #}
            </ul>
        </div>
        {% if config.plugins.login.enabled and grav.user.username %}
        <div id="collapsingMobileUser" class="collapse navbar-toggleable-custom dropdown-menu-custom p-x hidden-md-up" role="tabpanel" aria-labelledby="collapsingMobileUser">
            <div class="media m-t">
                {% if grav.user.email %}
                <div class="media-left">
                    <img src="http://www.gravatar.com/avatar/{{ grav.user.email|md5 }}?s=60" class="img-circle" alt="Gravatar"/>
                </div>
                {% endif %}
                {% if grav.user.fullname or grav.user.email %}
                <div class="media-body media-middle">
                    {% if grav.user.fullname %}
                    <h5 class="media-heading">{{ grav.user.fullname }}</h5>
                    {% endif %}
                    {% if grav.user.email %}
                    <h6>{{ grav.user.email }}</h6>
                    {% endif %}
                </div>
                {% endif %}
            </div>
            <a href="{{ base_url_absolute }}/admin/pages" class="dropdown-item text-uppercase">Manage pages</a>
            <a href="{{ base_url_absolute }}/admin/system" class="dropdown-item text-uppercase">Configuration</a>
            <a href="{{ base_url_absolute }}/admin/themes" class="dropdown-item text-uppercase">Installed themes</a>
            {% for item in site.userlinks %}
                <a href="{{ item.url }}" class="dropdown-item text-uppercase">{{ item.text }}</a>
            {% endfor %}
            <a href="{{ uri.url }}/task:login.logout" class="dropdown-item text-uppercase text-muted">Log out</a>
            <a href="{{ base_url_absolute }}/admin/users/{{ grav.user.username }}" class="btn-circle has-gradient pull-right">
                <span class="sr-only">Edit</span>
                <span class="icon-edit"></span>
            </a>
        </div>
        {% endif %}
    </div>
</nav>

Usually something like this is just an option on the Theme settings page, but not in this case🙂

Please let me know how things go.
Paul

Thanks Paul!
It worked out. With your help I was able to find that spot in the navigation.html.twig

Today it was a bit frustrated… I think my page will be too complex for landio (I also need menus). But landio is beautiful. Do you have any tip for another/similar theme which would be easier for modification?

Greetings, Matthias

Great to hear you got things going @beginners_mind. Grav is quite different from many other CMSs, but I’ve been able to customize it far easier than many (mostly because of Twig and its really good design).

By “menus” what are you looking for? All the other themes I know of are at https://getgrav.org/downloads/themes, but it is easier if you can start off with a skeleton https://getgrav.org/downloads/skeletons for the theme (like you did with Landio).

Paul, thanks for your kind support of my beginner questions.
I immeditley felt in love with grav. Some years ago I worked with Drupal, but I do not want to go back there…

I checked the skeletons again and I found “x-corporation” which would have one pop menu integrated. I am already quit far with landio: Do you think it would be a lot of work to add there a pop um menu?

You are most welcome @beginners_mind. Looking at that theme’s skeleton it seems that the pages within the folder “05.Features” are the basis for the existing drop-down menu. By copying that folder and then editing the page (folders) within it should get you started.

BTW, a few other theme’s also support dropdown menus in the Navbar, for example Bootstrap4 and my own Bootstrap4 Open Matter with Git Sync theme. Usually, you can find out if a theme supports that option by looking at its blueprint settings file, for example https://github.com/trilbymedia/grav-theme-bootstrap4/blob/develop/blueprints.yaml#L37

I do not know your theme requirements, but you might also want to take a look at the GitHub repo for themes of interest to see how much they are maintained etc if you are thinking of using the theme for a larger project etc.

Hope the above helps.
Pau