In my index file I extend the layout with the following markup:
extends layout
html
script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js')
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet',href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css')
script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js')
block content
h1= title
body
nav
.navbar.navbar-inverse
.container-fluid
.navbar-header
a
.navbar-brand(href='#') WebSiteName
ul.nav.navbar-nav
li.active
a(href='#') Home
li
a(href='#') Issues
li
a(href='#') Page 2
li
a(href='#') Page 3
I get the following error: Only named blocks and mixins can appear at the top level of an extending template.
Googled and tried some basic fixes that didn't help
layout.pug:
doctype html
html
head
title= title
link(rel='stylesheet', href='stylesheets/style.css')
block content
body
nav
.navbar
.container-fluid
.navbar-header
a
.navbar-brand(href='#') WebSiteName
ul.nav.navbar-nav
li.active
a(href='#') Home
li
a(href='#') Page 1
li
a(href='#') Page 2
li
a(href='#') Page 3
Can share ur extend layout code? Also try giving body and it sub elements a tab.
extends layout
block content
h1= title
body
script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js')
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet',href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css')
script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js')
nav
.navbar.navbar-inverse
.container-fluid
.navbar-header
a
.navbar-brand(href='#') WebSiteName
ul.nav.navbar-nav
li.active
a(href='#') Home
li
a(href='#') Issues
li
a(href='#') Page 2
li
a(href='#') Page 3