-
Notifications
You must be signed in to change notification settings - Fork 177
/
config.rb
265 lines (208 loc) · 6.02 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# coding: utf-8
###
# Site settings
###
# Look in data/site.yml for general site configuration
Time.zone = data.site.timezone || 'UTC'
# Automatic image dimensions on image_tag helper
activate :automatic_image_sizes
# Syntax highlighting
activate :syntax
# Make URLs relative
set :relative_links, true
# Set HAML to render HTML5 by default (when unspecified)
# It's important HAML outputs "ugly" HTML to not mess with code blocks
set :haml, format: :html5, ugly: true
# Set Markdown features for Kramdown
# (So our version of Markdown resembles GitHub's w/ other nice stuff)
set :markdown,
transliterated_header_ids: true,
parse_block_html: true,
parse_span_html: true,
tables: true,
hard_wrap: false,
input: 'GFM' # add in some GitHub-flavor (``` for fenced code blocks)
set :markdown_engine, :kramdown
set :asciidoc_attributes, %w(source-highlighter=coderay imagesdir=images)
set :asciidoctor,
toc: true,
numbered: true
# Set directories
set :css_dir, 'stylesheets'
set :fonts_dir, 'stylesheets/fonts'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :partials_dir, 'layouts'
###
# Blog settings
###
activate :blog do |blog|
blog.prefix = 'blog/'
blog.layout = 'post'
blog.tag_template = 'tag.html'
blog.calendar_template = 'calendar.html'
blog.default_extension = '.md'
blog.sources = ':year-:month-:day-:title.html'
# blog.permalink = ":year/:month/:day/:title.html"
blog.permalink = ':year/:month/:title.html'
blog.year_link = ':year.html'
blog.month_link = ':year/:month.html'
# blog.day_link = ":year/:month/:day.html"
blog.taglink = 'tag/:tag.html'
# blog.summary_separator = /(READMORE)/
# blog.summary_length = 99999
blog.paginate = true
blog.per_page = 10
blog.page_link = 'page=:num'
end
# activate :authors
# activate :drafts
# Enable blog layout for all blog pages
with_layout :post do
page '/blog.html'
page '/blog/*'
end
# Make pretty URLs
activate :directory_indexes
###
# Compass
###
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Don't have a layout for XML
page '*.xml', layout: false
# Docs all have the docs layout
with_layout :docs do
# page "/documentation/*"
# page "/documentation*"
end
with_layout :feature do
page "/feature/*"
page "/md/source/feature/*" # Temporary dir
end
# Don't make these URLs have pretty URLs
page '/404.html', directory_index: false
page '/.htacces.html', directory_index: false
# Proxy pages (http://middlemanapp.com/dynamic-pages/)
# proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
# :which_fake_page => "Rendering a fake page with a local variable" }
proxy '/.htaccess', '/.htaccess.html', locals: {}, ignore: true
ready do
# Add yearly calendar pages
data.events.each do |year, data|
next unless year.match(/[0-9]{4}/)
proxy "/events/#{year}.html", "events/index.html", locals: {year: year}
end
# Add author pages
sitemap.resources.group_by { |p| p.data['author'] }.each do |author, pages|
next unless author
proxy "/blog/author/#{author.parameterize.downcase}.html",
'author.html',
locals: { author: author, pages: pages },
ignore: true
end
proxy '/blog/author.html', 'author.html', ignore: true
# Add blog feeds
blog.tags.each do |tag_name, _tag_data|
next unless tag_name
proxy "/blog/tag/#{tag_name.downcase}.xml",
'feed.xml',
locals: { tag_name: tag_name },
ignore: true
end
proxy '/blog/feed.xml', 'feed.xml', ignore: false
proxy '/blog/tag/index.html', 'tag.html', ignore: true
end
###
# Helpers
###
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
# helpers do
# end
require 'lib/site_helpers.rb'
activate :site_helpers
require 'lib/blog_helpers.rb'
activate :blog_helpers
require 'lib/confcal.rb'
activate :confcal
require 'lib/monkeypatch_blog_date.rb'
###
# Development-only configuration
###
#
configure :development do
puts '== Administration is at http://0.0.0.0:4567/admin/'
activate :livereload
# config.sass_options = {:debug_info => true}
# config.sass_options = {:line_comments => true}
compass_config do |config|
config.output_style = :expanded
config.sass_options = { debug_info: true, line_comments: true }
end
end
# Build-specific configuration
configure :build do
## Ignore administration UI
ignore '/admin/*'
ignore '/javascripts/admin*'
ignore '/stylesheets/lib/admin*'
## Ignore Gimp source files
ignore 'images/*.xcf*'
# Don't export source JS
ignore 'javascripts/vendor/*'
ignore 'javascripts/lib/*'
# Don't export source CSS
ignore 'stylesheets/vendor/*'
ignore 'stylesheets/lib/*'
ignore 'events-yaml*'
# Minify JavaScript and CSS on build
activate :minify_javascript
activate :minify_css
# activate :gzip
# Force a browser reload for new content by using
# asset_hash or cache buster (but not both)
activate :cache_buster
# activate :asset_hash
# Use relative URLs for all assets
# activate :relative_assets
# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher
# Or use a different image path
# set :http_path, "/Content/images/"
# Favicon PNG should be 144×144 and in source/images/favicon_base.png
# Note: You need ImageMagick installed for favicon_maker to work
activate :favicon_maker do |f|
f.template_dir = File.join(root, 'source', 'images')
f.output_dir = File.join(root, 'build', 'images')
f.icons = {
'favicon_base.png' => [
{ icon: 'favicon.png', size: '16x16' },
{ icon: 'favicon.ico', size: '64x64,32x32,24x24,16x16' }
]
}
end
end