Add extra page headers automatically to every page

I want to protect every page so that every unregistered user can not view the pages, unless they login.

I know there is a private plugin, but I do not want to use this, I just want to use the login plugin for this.
So, I need to add the following ags to every page:

site.login: true
admin.login: true

But can this be added automatically every time I add a new page? Do I need to change something in the theme? I am using the learn2 theme.

Do you mean when a Page is added via the Admin Panel? With a custom Blueprint I think you should be able to set defaults for those values:

Hello Paul,

Yes, when I create a new page via the default template, I want to have added the following (in bold):

title: 'Title of my page’
site.login: true
admin.login: true

I presume I need to change the default.html.twig, but I do not know where to put exactly these fields:

{% embed 'partials/base.html.twig' with { github_link_position: false } %}

    {% block sidebar %}
    <nav id="sidebar">
        <div id="header-wrapper">
            <div id="header">
                <a id="logo" href="{{ theme_config.home_url ?: base_url_absolute }}">{% include 'partials/logo.html.twig' %}</a><br>
                {% include 'partials/search.html.twig' %}
        {% include 'partials/sidebar.html.twig' %}
    {% endblock %}

    {% block content %}
        {% include 'partials/page.html.twig' %}
    {% endblock %}

    {% block footer %}{% endblock %}

{% endembed %}

I’ve looked into this a bit more and while I was hoping a Blueprint change would do what you want it does not look like page access items are there by default. A custom Blueprint might still be an option, but I’ve not done anything re: access rights and Blueprints myself.

Hi Paul,

Thanks for your effort.




I found a solutions, but it is a tweak in Grav and probably will be undone when Grav is updated. Maybe there is a better way.

I edited the file /var/www/ and added, above line 210.

type: checkboxes
toggleable: true
config-default@: system.pages.access
site.login: true
admin.login: true
site.login: Site Login
admin.login: Admin Login
use: keys

Also I have edited the /var/www/ and added, above line 264:

ACCESS: “Restrict Access”
ACCESS_HELP: “Enables access restrictions controlled by the login plugin”

Then you see:

I only need to find a way to enable this option by default.



Looks like you are making progress @rvreugde! You should be able to define the default right in that Blueprint you are editing, at least I would think so.

More info here : and sample blueprint setting default value here:

So maybe default: true instead of config-default@: system.pages.access to force it on by default?

Any news ? I would like to do the same for data.