'Unexpected Block Content

Have a problem when running my nodeJS and express application using '.pug' in the frontend.

Tried indenting it many ways, yet unable to solve the issue.

extends ./layout.pug

block content


  section#welcome

    div

      h1 Hi #{name}!


  section

    #day

      #time.day-sec

        //h2= today_date (disgarded, this is the backend time) 

        h2.time

      #weather.day-sec

        h2= today_weather


  section

    #main-func


      #courses

        h3 Courses Today

        #courses-list

          ul

            li SSW 690 | 12:00-14:30 |A 115

            li SSW 565 | 18:15-20:45 |BC 310


      #assignments

        h3 Upcoming Due

        ul

          li

            span 18:00

            |  SSW 565 | Weekly

            |                             Assignment: Apache Styles - G1

          li

            span 23:59

            |  SSW 567 | Quiz 04

          li

            span 23:59

            |  CPE 593 | Optional: find

            |                             optimal k for Knuth

When i remove the 'block content' i get an error saying "Only named blocks and mixins can appear at the top level of an extending template", but upon using it the error is an 'unexpected block content'.

pug


Solution 1:[1]

An unexpected block content error can occur if block content is missing from your layout file.

So your layout.pug should look something like:

html
    head
        meta(charset="UTF-8")
        title My Title 
    body 
        block content
        //If this line above is missing then you will get the error

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1