trulia / hologram

A markdown based documentation system for style guides.
http://trulia.github.io/hologram
Other
2.16k stars 199 forks source link

Setting :title for markdown files #188

Closed micahgodbolt closed 9 years ago

micahgodbolt commented 9 years ago

I'm currently using some .md pages to write up pure documentation pages (not associated with any category, just straight up docs). In both Hologram and Cortana theme the title of the page is set via the doc block. But for markdown files it appears that an empty doc block is passed in during rendering.

def process_files(files, directory, doc_block_collection)
      files.each do |input_file|
        if input_file.end_with?('md')
          @pages[File.basename(input_file, '.md') + '.html'] = {:md => File.read("#{directory}/#{input_file}"), :blocks => []}
        elsif input_file.end_with?('erb')
          @pages[File.basename(input_file, '.erb')] = {:erb => File.read("#{directory}/#{input_file}")}
        else
          process_file("#{directory}/#{input_file}", doc_block_collection)
        end
      end
    end

Is there any other way to set the title for these pages? I'd hate to have to create conditions in my header.html for every single page I create.

<% if file_name.include?('my-file.html') %>`<h1>My File</h1> 
<% elsif file_name.include?('my-other-file.html') %>`<h1>My Other File</h1> 
<% end %>
jdcantrell commented 9 years ago

Right now I don't think there is a way to set the title for markdown, but this would be a good feature to have.