Show either a node or a blocks page at frontpage At the path "/" - the frontpage of my site, I want to show either


For anonymous users, the content of a particular node, which is normally available at "/somepath".
For authenticated users, a series of blocks.


How do I do this?

I think the most elegant answer involves using page manager to take control of the "/" route. With this it is easy to show a series of blocks as one variant, but I don't see how to show a particular node.

I have tried setting the "Default front page" at admin/config/system/site-information to "/somepath". But when I do this my panel page defined in page manager does not show up, either when it targets "/" or "/somepath".

As a fallback, I can probably achieve the same result without page manager at all, by choosing to hide the "content" block on the home page and show only the blocks I want. But I worry this gets messy fast, even using the block visibility groups module to avoid repeating the conditions.
I agree, the block layout gets quite messy when you try to do this. Another option would be a separate twig template for the front page.

Create two new regions frontpage_auth and frontpage_anon and fill them with the blocks you want to show. Don't configure the visibility here. Just place the blocks.

Modify page.html.twig, so that {{ page.content }} is enclosed in a twig block maincontent:

{% block maincontent %}
  {{ page.content }}
{% endblock %}


Then create a new twig file for the front page

page--front.html.twig

{% extends "page.html.twig" %}

{% block maincontent %}

  {% if logged_in %}
    {{ page.frontpage_auth }}
  {% else %}
    {{ page.frontpage_anon }}
  {% endif %}

{% endblock %}


where you display one of the two regions dependent on the variable logged_in.

For the node you can use the Main page content block or you can put the node in a view and use this view as a block.