Twig Template stylesheet einbinden
Über eine Frontend Route gebe ich ein Template aus.
Mein template liegt in Resources -> contao-> views -> MyCustom -> fe_page.html.twig
Ich möchte in den html Head ein Stylesheet einfügen und habe versucht fe_page zu extenden.
PHP-Code:
{% extends '@Contao/fe_page' %}
{% block body %}
<h1>Welcome to our Demo Homepage</h1>
<p>Selected Fonts</p>
<ul>
{% for tag in html_definition %}
<li>{{ tag.heading_1 }}</li>
<li>{{ tag.heading_2 }}</li>
<li>{{ tag.heading_3 }}</li>
<li>{{ tag.heading_4 }}</li>
<li>{{ tag.heading_5 }}</li>
<li>{{ tag.heading_6 }}</li>
<li>{{ tag.strong }}</li>
<li>{{ tag.paragraph }}</li>
{% endfor %}
</ul>
{% endblock %}
Bekomme aber bereits hier die Fehlermeldung :
PHP-Code:
Unable to find template \"fe_page\" (looked into: /var/www/contao.loc/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views, /var/www/contao.loc/templates) in \"@MyName/MyCustom/fe_page.html.twig\" at line 1. at /var/www/contao.loc/vendor/twig/twig/src/Loader/FilesystemLoader.php:250)"} []
Diesen Block wollte ich dann in den head einfügen
PHP-Code:
{% block head %}
<link
href="{{ asset('bundles/myname/css/my.css') }}"
rel="stylesheet"
/>
{% endblock %}