Is there a Nanoc method to get the just filename of a layout without the extension?

9 views
Skip to first unread message

Dave Everitt

unread,
Dec 30, 2019, 11:06:33 AM12/30/19
to nanoc
I'm currently using this to get the filename of a layout so I can use it in my content:

<%= lt = @layout[:filename].gsub('layouts/',''); lt.gsub(lt[-5..-1],'').capitalize() %>: <%= @item[:title] %>

My Ruby's a bit rusty and I can't find a Nanoc method to do this more directly (or a nicer Ruby way to do it) - any improvements?

My layouts are all named with single words, a-z only.

Dave Everitt

unread,
Dec 30, 2019, 4:02:38 PM12/30/19
to nanoc
 ignore the last part
 
: <%= @item[:title] %>

which was pasted by accident at the end
Reply all
Reply to author
Forward
0 new messages