Reputation: 1089
my layout.slim view is:
doctype html
html
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
title= "Title"
meta name="description" content=""
meta name="author" content=""
meta name="keywords" content=""
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href='/css/base.css' rel='stylesheet' type='text/css'
body
== yield
my main.slim view is
== slim :layout
h1 hello
h2 world
it renders fine, but my rendered html duplicates the head attributes also into the body tag! it looks like this:
html
head
meta..
meta..
title ...
...
body
meta..
meta..
title ...
...
<h1>Hello</h1>
...
why is it like that?
(btw, the reason I am using "== slim :layout" is to enable nested inheritance of templates (i.e. layout.slim -> main.slim -> form.slim)
Upvotes: 0
Views: 1171
Reputation: 44370
You have wrong indentation in you layout, body
should be inside html
and == yield
inside body so instead:
doctype html
html
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
title= "Title"
meta name="description" content=""
meta name="author" content=""
meta name="keywords" content=""
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href='/css/base.css' rel='stylesheet' type='text/css'
body
== yield
Use this:
doctype html
html
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
title= "Title"
meta name="description" content=""
meta name="author" content=""
meta name="keywords" content=""
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href='/css/base.css' rel='stylesheet' type='text/css'
body
== yield
Upvotes: 1