In Jekyll, we write layout structure in a HTML file and put it in _layout folder. Say, the _layout folder has file named welcome.html, for a webpage to use it, we simply specify as follows:
---
title: Awesome webpage
layout: welcome
---
How to do the same when using nanoc? I thought it works the same way, but unfortunately, it seems like not picking up the welcome template. It is just picking up the default.html template.
Is it because of the file called rule which has the following lines?
compile '/' do
filter :erb
layout 'default'
end
I want only one specific file to pick up the welcome layout. How to do it?
In the Rules file, call
#layoutlike this:This will call
#layoutwith whatever is in thelayoutattribute of the item.To fall back to a default when no
layoutattribute is specified, use#fetch:This will use whatever layout is specified in the
layoutattribute, falling back to the layout that matches/default.*.For your specific case, you probably want the
layoutattribute to be something like/welcome.html, like this:... but you can also manipulate the string you get back from
#fetchif you prefer, so that putting justwelcomein the item metadata will work. This would be less work overall if you were importing a lot of Jekyll pages, for example.