i need to get meta data of the page in twig, for replace them by my values, but i don't find how get them.
For now i have :
{% if spec.name matches '{meta}' %}
{% set getdatas = app.request.server.get('REQUEST_URI') %} // use uri for test, i need the same but with meta_title, meta_description...
{{ dump(uri|replace({'domaine': spec.name})) }}
{% endif %}
If you want to override anything in Twig, you need to create a block for it. As an example:
base.html.twig
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
{% block meta %}{% endblock %}
<title>{% block title %}{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>
parent.html.twig
{% extends 'base.html.twig' %}
{% block stylesheets %}
# My extra styles...
{% endblock %}
{% block body %}
<div>
{% block content %}{% endblock %}
</div>
{% endblock %}
child.html.twig
{% extends 'parent.html.twig' %}
{% block title %}My page{% endblock %}
{% block meta %}
<meta key="value">
{% endblock %}
{% block content %}My content{% endblock %}
my parent template :
{% extends 'DesignBundle::Front/layout.html.twig' %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('bundles/extension/css/flag-icon.min.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/extension/css/main.css') }}">
{% endblock %}
{% block title %}
{{ _("Caractéristiques des noms de domaine") ~ " ." ~ extension.nomExt|idna_decode }}</code>
{% if extension.countryName is not empty %}
{{ " - " ~ extension.countryName|utf8_fix }}
{% endif %}
{% endblock %}
{% block content %} // view in first post is call here
{% include 'ExtensionBundle:New_fiche:show_content.html.twig' %}
{% endblock %}