Nanoc layout compile Rules

老子叫甜甜 提交于 2019-12-11 12:17:42

问题


I'm working with nanoc and I want my index.html to point to specific layout so I created that layout and it is called nosidebar.html

My Rules looks like:

compile 'index.html' do 
  layout 'nosidebar'
end

and this doesn't seem to work. What am I doing wrong?


回答1:


I haven't done exactly what you are but maybe something like this:

compile '/' do 
  rep.layout 'nosidebar'
end



回答2:


You can always add something like:

compile '*' do
  if item.binary?
    # don’t filter binary items
  else
    layout item[:layout] || 'default'
  end
end

That means you can just decide the template on the file by adding:

---
layout: nosidebar
---

at the yaml front matter of the file.



来源:https://stackoverflow.com/questions/5254834/nanoc-layout-compile-rules

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!