2018-12-08 10:55:08 +00:00
|
|
|
# Activate and configure extensions
|
|
|
|
# https://middlemanapp.com/advanced/configuration/#configuring-extensions
|
|
|
|
|
2020-12-27 15:51:03 +00:00
|
|
|
set :relative_links, true
|
|
|
|
|
2018-12-08 12:05:59 +00:00
|
|
|
set :markdown_engine, :redcarpet
|
2020-12-05 17:44:34 +00:00
|
|
|
set :markdown, :fenced_code_blocks => true, :smartypants => true, :with_toc_data => true
|
2018-12-08 12:05:59 +00:00
|
|
|
|
|
|
|
activate :syntax
|
|
|
|
|
|
|
|
activate :directory_indexes
|
|
|
|
|
2018-12-08 10:55:08 +00:00
|
|
|
activate :autoprefixer do |prefix|
|
|
|
|
prefix.browsers = "last 2 versions"
|
|
|
|
end
|
|
|
|
|
|
|
|
page '/*.xml', layout: false
|
|
|
|
page '/*.json', layout: false
|
|
|
|
page '/*.txt', layout: false
|
|
|
|
|
2018-12-08 12:05:59 +00:00
|
|
|
configure :build do
|
2019-05-31 10:45:52 +00:00
|
|
|
# activate :minify_css
|
|
|
|
# activate :minify_javascript
|
2018-12-08 12:05:59 +00:00
|
|
|
end
|
2020-12-27 15:51:03 +00:00
|
|
|
|
|
|
|
DEFAULT_LANGUAGE = "en"
|
|
|
|
|
|
|
|
helpers do
|
|
|
|
def link_to_lang(name, code, **opts)
|
|
|
|
base = code == DEFAULT_LANGUAGE ? "/" : "/#{code}/"
|
|
|
|
path = base + current_page.path
|
|
|
|
.sub(/index\.html\z/, "")
|
|
|
|
.sub(%r|\.html\z|, "/")
|
|
|
|
link_to(h(name), path, hreflang: h(code), rel: "alternate")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def URI.escape(*args)
|
|
|
|
encode_www_form_component(*args)
|
|
|
|
end
|