diff --git a/tech-docs/config.rb b/tech-docs/config.rb index 87f4b96..2d6cdbd 100644 --- a/tech-docs/config.rb +++ b/tech-docs/config.rb @@ -1,5 +1,22 @@ +# frozen_string_literal: true + require 'govuk_tech_docs' +GovukTechDocs::TableOfContents::Helpers.module_eval do + def list_items_from_headings(html, url: '', max_level: nil) + headings = GovukTechDocs::TableOfContents::HeadingsBuilder.new(html, url).headings + + if headings.none? { |heading| heading.size == 1 } + resource = sitemap.find_resource_by_path("#{url[1..]}index.html") + html = "