One sign for every page

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

  1. Create the home page (accueil): route /, named app_accueil, which renders accueil.html.twig. This template extends base.html.twig, says welcome in an <h1> (“Welcome to the Drunken Dragon”) and has its own page title.
  2. 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().
  3. 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 _.