Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Deeper into Routing with Express Redirects

Rohit Thorat
Rohit Thorat
12,191 Points

indentation problem

extends layout.pug

 block content
  section#content
    h2 Welcome,#{name}!

what is wrong in the code? my /hello route is working fine but when i am giving the name as input my home route is showing error..

Albert Boehm
Albert Boehm
5,878 Points

Could you post the related app.js code snippet? It is hard to judge what might've gone wrong from this alone.

1 Answer

Zack Lee
PLUS
Zack Lee
Courses Plus Student 17,662 Points

pug is extremely sensitive with tabs and spaces. you must be consistent across the file when using tabs or spaces. This is annoying cause its hard to tell where tabs vs spaces are used, especially when copy/pasting some template into your file. I would go through and just make sure if you use tabs or spaces that its consistent across the file.

Neil McPartlin
Neil McPartlin
14,662 Points

Rohit, Zack has called it. If you remove that single space before the word 'block', your snippet will work.

In addition to what Zack said, most modern editors allow your tab key to actually insert spaces instead of tabs, you can usually set the number of spaces as well. This is useful for all around consistence and especially useful while using Pug.