-
Notifications
You must be signed in to change notification settings - Fork 11
/
config.rb
36 lines (28 loc) · 1.36 KB
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "govuk_tech_docs"
require "lib/header_menu_fix_extension"
require "lib/package_contents"
require "lib/sassdocs_helpers"
require "lib/table_of_contents_helpers"
# Patch the GovukTechDocs cleanly
# https://www.justinweiss.com/articles/3-ways-to-monkey-patch-without-making-a-mess/
require "lib/ext/govuk_tech_docs/tech_docs_html_renderer/reset_unique_identifier_generator_preprocess"
GovukTechDocs::TechDocsHTMLRenderer.include Ext::GovukTechDocs::TechDocsHTMLRenderer::ResetUniqueIndentifierGeneratorPreprocess
GovukTechDocs.configure(self)
::Middleman::Extensions.register(:header_menu_fix, HeaderMenuFixExtension)
activate :header_menu_fix
# Load our own version of GOV.UK Frontend before the one registered by the
# tech_docs_gem otherwise we may be using styles and scripts
# from an outdated version the time for the tech_docs_gem to catch up
sprockets.prepend_path File.join(__dir__, "./node_modules/govuk-frontend/")
# Prevent pages from being indexed unless GitHub Actions is building the main branch
config[:tech_docs][:prevent_indexing] = (ENV["GITHUB_REF"] != "refs/heads/main")
helpers do
include PackageContents
include SassdocsHelpers
include TableOfContentsHelpers
def markdown(content = nil)
concat Tilt["markdown"].new(context: @app) { content }.render
end
end
page "v4/*", layout: :v4, data: { parent: "/v4/" }
page "*", data: { parent: "/" }