Error.html.twig in new theme


I followed the tutoriel to create a personalized theme and I meet a problem with the page error. I have no contents for the moment, Antimatter theme show “Error 404 Woops. Looks like this page doesn’t exist.” All is well :slight_smile:

I copied the file user/themes/antimatter/templates/error.html.twig in the directory user/themes/mypersonaltheme/templates/error.html.twig. Once the new theme was activated, I have the header which displays but not the contents of the file error.html.twig.

Somebody has an idea?

If you look at the content of the error.html.twig file from the Antimatter theme it looks like this:

{% extends 'partials/base.html.twig' %}

{% block content %}
	<div id="error">
			<h1>Error {{ page.header.http_response_code }}</h1>
				{{ page.content }}
{% endblock %}

As you can see it extends a partials/base.html.twig file, and then it overrides the content block. If your mypersonaltheme doesn’t define this content block, then nothing will display.

So just make sure you have a content block definition like in Antimatter:

<section id="body" class="{{ class }}">
        {% block content %},{% endblock %} 

The {% block content%},{% endblock %} will be replaced by the code in your error.html.twig.

It was the problem, thank you.