-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.rb
105 lines (85 loc) · 3.26 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
# Activate and configure extensions
# https://middlemanapp.com/advanced/configuration/#configuring-extensions
#
activate :autoprefixer do |prefix|
prefix.browsers = "last 2 versions"
end
# Layouts
# https://middlemanapp.com/basics/layouts/
# Per-page layout changes
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
# With alternative layout
# page '/path/to/file.html', layout: 'other_layout'
# Proxy pages
# https://middlemanapp.com/advanced/dynamic-pages/
# proxy(
# '/this-page-has-no-template.html',
# '/template-file.html',
# locals: {
# which_fake_page: 'Rendering a fake page with a local variable'
# },
# )
visible_speakers = data.speakers.select{ |s| (defined? s.show) ? s.show : true }
visible_speakers.each do |s|
proxy "/speakers/#{s.tag}/index.html", "/person_template.html", :locals => { :person => s, :bio => @app.data.bios[s.tag] }, :ignore => true
end
data.program_committee.each do |pc|
proxy "/program-committee/#{pc.tag}/index.html", "/person_template.html", :locals => { :person => pc }, :ignore => true
end
data.workshops.items.each do |w|
proxy "/workshops/#{w.tag}/index.html", "/workshops/template.html", :locals => { :workshop => w }, :ignore => true
end
# Helpers
# Methods defined in the helpers block are available in templates
# https://middlemanapp.com/basics/helper-methods/
helpers do
def utm_link url
url + "?utm_source=devconf"
end
def twitter_link handle
'https://twitter.com/' + handle
end
def linkedin_link handle
'https://www.linkedin.com/in/' + handle + '/'
end
def js_link name, ver
'<script src="/javascripts/' + name + '.js?v=' + ver + '"></script>'
end
def css_link name, ver
'<link href="/stylesheets/' + name + '.css?v=' + ver + '" rel="stylesheet">'
end
def markdown(text=nil)
text ||= yield
return Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true).render(text)
end
end
# Build-specific configuration
# https://middlemanapp.com/advanced/configuration/#environment-specific-settings
# configure :build do
# activate :minify_css
# activate :minify_javascript
# end
#
## Configuration code for Middleman AWS S3 Sync
# See middleman-s3_sync documentation: https://github.com/fredjean/middleman-s3_sync
activate :s3_sync do |s3_sync|
# The name of the S3 bucket you are targeting. This is globally unique.
s3_sync.bucket = ENV['AWS_S3_BUCKET_NAME']
# The AWS region code for your bucket.
# For region codes: http://www.bucketexplorer.com/documentation/amazon-s3--amazon-s3-buckets-and-regions.html
s3_sync.region = ENV['AWS_REGION']
s3_sync.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
s3_sync.aws_secret_access_key = ENV['AWS_SECRET_KEY']
#s3_sync.delete = true # We delete stray files by default.
#s3_sync.after_build = true # We do not chain after the build step by default.
end
# CloudFront cache invalidation
activate :cdn do |cdn|
cdn.cloudfront = {
access_key_id: ENV['AWS_ACCESS_KEY_ID'], # default ENV['AWS_ACCESS_KEY_ID']
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], # default ENV['AWS_SECRET_ACCESS_KEY']
distribution_id: ENV['PRODUCTION_CLOUDFRONT_DISTRIBUTION_ID']
}
end