I am inexperienced with a middleman and ruby, but I tried to get Slate so that it creates side navigation / list of the header during build, and not on the client side using javascript. The problem I am facing is that the code includes partial headers.
Example directory structure:
Source +--config.rb +--includes +--file.md +--otherfile.md +--index.html +--layouts +--layout.erb
The essence of the layout and config.rb
Config.rb file for this:
require 'nokogiri' helpers do def toc_data(page_content) html_doc = Nokogiri::HTML::DocumentFragment.parse(page_content)
Layout for this:
<ul id="toc" class="toc"> <% toc_data(page_content).each do |h1| %> <li> <a href="#<%= h1[:id] %>" class="toc-h1"><%= h1[:content] %></a> <ul class="toc-section"> <% h1[:children].each do |h2| %> <li> <a href="#<%= h2[:id] %>" class="toc-h2"><%= h2[:content] %></a> <ul class="toc-submenu"> <% h2[:children].each do |h3| %> <li> <a href="#<%= h3[:id] %>" class="toc-h3"><%= h3[:content] %></a> </li> <% end %> </ul> </li> <% end %> </ul> </li> <% end %> </ul> ... <div class="page-wrapper"> <div class="content"> <%= page_content %> <% current_page.data.includes && current_page.data.includes.each do |include| %> <%= partial "includes/#{include}" %> <% end %> </div> </div>
Currently, only the headers from the index.html file and none of the parts included in it are filled. I believe that I might need an existing helper to create a post-build, similar to what Middleman docs for Sitemaps use with the ready helper. I believe that I need to make another change to the configuration code so that it captures additional content outside of page_content , but I'm not sure that this is due to a lack of acquaintance. Any pointers would be appreciated.
Edit: After looking at the broker's manual documents, there are two helpers from the Padrino structure that I could use: capture_html and concat_content . I am trying to find where the page_content helper page_content defined in order to get additional context for the specific changes I am making.
Alyss source share