-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.rb
173 lines (138 loc) · 4.25 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
activate :dotenv
require 'rgbapng'
###
# Blog settings
###
Time.zone = "Paris" # default : UTC
activate :blog do |blog|
# blog.prefix = "blog"
# blog.permalink = ":year/:month/:day/:title.html"
# blog.sources = ":year-:month-:day-:title.html"
# blog.taglink = "tags/:tag.html"
blog.layout = "post"
blog.summary_separator = /<!--\s?more\s?-->/
blog.summary_length = BigDecimal::INFINITY
# blog.summary_length = 250
# blog.year_link = ":year.html"
# blog.month_link = ":year/:month.html"
# blog.day_link = ":year/:month/:day.html"
blog.default_extension = ".md"
blog.sources = "posts/:year-:month-:day-:title.html"
blog.tag_template = "tag.html"
blog.calendar_template = "calendar.html"
blog.paginate = true
# blog.per_page = 10
# blog.page_link = "page/:num"
end
ready do
# Add bower's directory to sprockets asset path
@bower_config = JSON.parse(IO.read("#{root}/.bowerrc"))
sprockets.append_path File.join "#{root}", @bower_config["directory"]
blog.tags.each do |tag, articles|
page "/tags/#{tag}/atom.xml", proxy: "/atom.xml", layout: false do
@tagname = tag
@articles = articles[0..10]
end
end
end
###
# Localization settings
###
activate :i18n, :mount_at_root => :en
###
# Helpers
###
# Automatic image dimensions on image_tag helper
activate :automatic_image_sizes
# Reload the browser automatically whenever files change
# activate :livereload
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
helpers do
def site_url
'//' + settings.host
end
end
###
# General settings
###
# Syntax Highlighting
activate :syntax, line_numbers: true
# Assets PATH
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :build_dir, 'build'
set :partials_dir, 'partials'
set :fonts_dir, 'fonts'
ignore /.*\.kate-swp/
ignore /.*\.new/
# Livereload
# use: https://github.com/middleman/middleman-livereload
activate :livereload
# make /praxis.html appear as /praxis/
activate :directory_indexes
set :trailing_slash, true
set :markdown_engine, :kramdown # now default
set :markdown, :parse_block_html => true
# Slim configuration
set :slim, {
:format => :html5,
:indent => ' ',
:pretty => true,
:sort_attrs => false
}
::Slim::Engine.set_default_options lang: I18n.locale, locals: {}
configure :development do
set :disqus, 'middleman-due-color-testing'
set :host, 'localhost:4567'
end
# Build-specific configuration
configure :build do
set :disqus, 'middleman-due-color'
set :host, 'rriemann.github.io'
# Enable cache buster
# activate :asset_hash
# Make favicons
# use: https://github.com/follmann/middleman-favicon-maker
activate :favicon_maker, :icons => {
"favicon_base.png" => [
{ icon: "apple-touch-icon-114x114-precomposed.png" },
{ icon: "apple-touch-icon-72x72-precomposed.png" },
{ icon: "apple-touch-icon-57x57-precomposed.png" },
{ icon: "apple-touch-icon-precomposed.png", size: "57x57" },
{ icon: "apple-touch-icon.png", size: "57x57" },
{ icon: "favicon.png", size: "16x16" },
{ icon: "favicon.ico", size: "16x16" },
]
}
# Minify
# see: https://github.com/middleman/middleman-guides/blob/master/source/advanced/file-size-optimization.html.markdown#compressing-images
activate :minify_css
activate :minify_javascript
activate :minify_html
# Enable cache buster
# see: https://github.com/middleman/middleman-guides/blob/master/source/advanced/improving-cacheability.html.markdown#cache-buster-in-query-string
activate :cache_buster
# Use relative URLs
# activate :relative_assets
# set :relative_links, true
# Or use a different image path
set :http_prefix, '/middleman-blog-template-duocolor/'
end
activate :deploy do |deploy|
deploy.method = :git
# Optional Settings
# deploy.remote = "custom-remote" # remote name or git url, default: origin
# deploy.branch = "custom-branch" # default: gh-pages
# deploy.strategy = :submodule # commit strategy: can be :force_push or :submodule, default: :force_push
end
## custom
# Dir[File.dirname(__FILE__) + '/lib/tags/*.rb'].each {|file| require file }
# require 'lib/tags/image_tag'
# require "lib/custom_helpers"
# helpers CustomHelpers