Exercise 4 of 8 in chapter 1
· 120 XP
· 5 objectives checked by tests
Topics covered:Twig inheritanceincludepath()
Adventurers find their way to /menu… but the tavern's front door, /, leads nowhere. And there's no way to get from one page to another. Time to hang one sign for every page.
Your mission
Create the home page (accueil): route /, named app_accueil, which renders accueil.html.twig. This template extendsbase.html.twig, says welcome in an <h1> (“Welcome to the Drunken Dragon”) and has its own page title.
Write the navigation in the partial template_nav.html.twig: a <nav> with a link to the home page and a link to the menu, generated with path().
Include this partial in base.html.twig, under the sign: it will then appear on every page that extends it (home, menu, dish pages).
Reminder
Inheritance (extends + block) shares a structure; inclusion (include) reuses a piece of template. By convention, partial names start with _.