mirror of
https://github.com/danog/sass-site.git
synced 2024-11-27 04:24:50 +01:00
Put the table of contents where it's supposed to go (#267)
This commit is contained in:
parent
8b2d48f774
commit
97c5ac21af
@ -54,6 +54,8 @@ before_render do |body, _, _, template_class|
|
||||
if current_page.data.table_of_contents &&
|
||||
template_class == Middleman::Renderers::RedcarpetTemplate
|
||||
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC.new)
|
||||
markdown.render(body).sub(/<ul( |>)/, '<ul class="table-of-contents"\1') + body
|
||||
current_page.add_metadata(table_of_contents:
|
||||
markdown.render(body).sub(/<ul( |>)/, '<ul class="table-of-contents"\1'))
|
||||
body
|
||||
end
|
||||
end
|
||||
|
@ -6,10 +6,5 @@
|
||||
|
||||
- if current_page.data.table_of_contents
|
||||
- content_for :complementary do
|
||||
-# Put table of contents here and make it conditional
|
||||
%nav.sl-c-list-navigation-wrapper
|
||||
:markdown
|
||||
- put
|
||||
- your
|
||||
- links
|
||||
- here
|
||||
= current_page.metadata[:table_of_contents]
|
||||
|
Loading…
Reference in New Issue
Block a user