comment mettre un ico dans twig ?

Par Galaacky, il y a 4 ans


Je cherche a mettre un favicon

{% extends 'base.html.twig' %} {% block title 'GalaaDox | DOKS' %} {% block body %} <h1>{{ numberDoks(doks|length, 'Dok', 'Doks')}}</h1> <style> *{color: #3a3737;background-color: #eeeeee; /*margin: 7px; !! IN PRODUCTION !! */} a,a:visited,a:link,a:active,a:focus{text-decoration: none;color: #66ccff; } a:hover{text-decoration: none;color:#990000;} p{color: #3a3737;} </style> {% for dok in doks %} <article> <h2><a href="{{ path('app_doks_show', {id: dok.id}) }}">{{dok.title}}</a></h2> <p>{{dok.description}}</p> </article> {% endfor %} {% endblock %}''

Ce que je veux

Bonjour a tous , je cherche un mettre un favicon dasn du twig or je bne trouve pas comment faire. J'ai regardé sur plusiers site , regardé plusieurs vidéos mais aucune solution. En auriez-vous une ?

3 réponses

Soundboy39, il y a 4 ans

Je suppose que la favicon devra être visible sur toutes les pages ?

Dans ce cas, pourquoi ne pas simplement ajouter un <link rel="icon"... dans la partie <head> du fichier "...\templates\base.html.twig" ?

Galaacky, il y a 4 ans
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <link rel="icon" type="image/x-icon" href="../src/icons/favicon.ico" /> <title>{% block title %}Welcome!{% endblock %}</title> {# Run `composer require symfony/webpack-encore-bundle` and uncomment the following Encore helpers to start using Symfony UX #} {% block stylesheets %} {#{{ encore_entry_link_tags('app') }}#} {% endblock %} {% block javascripts %} {#{{ encore_entry_script_tags('app') }}#} {% endblock %} </head> <body> {% block body %}{% endblock %} </body> </html>

Ca ne fonctionne pas...

Soundboy39, il y a 4 ans

Tu est sur du chemin ??
Tu n'a pas d'erreur 404 dans la console ?

Personnellement je verrais plutôt ce genre d'élement dans le dossier "public"...