-
Notifications
You must be signed in to change notification settings - Fork 14
/
docpad.js
263 lines (223 loc) · 7.3 KB
/
docpad.js
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
'use strict'
// Require
const helpers = require('outpatient')
// Prepare
const docpadVersion = require('./package.json').dependencies.docpad.toString().replace('~', '').replace('^', '')
const siteUrl = process.env.NODE_ENV === 'production' ? 'https://docpad.org' : 'http://localhost:9778'
// =================================
// Configuration
// The DocPad Configuration File
const docpadConfig = {
// =================================
// Template Data
// These are variables that will be accessible via our templates
// To access one of these within our templates, refer to the FAQ: https://github.com/bevry/docpad/wiki/FAQ
templateData: {
// -----------------------------
// Misc
text: {
heading: 'DocPad',
copyright: 'DocPad is a <a href="https://bevry.me" title="Bevry - An open company and community dedicated to empowering developers everywhere.">Bevry</a> creation.',
linkNames: {
main: 'Website',
learn: 'Learn',
email: 'Email',
twitter: 'Twitter',
support: 'Support',
showcase: 'Showcase'
}
},
navigation: {
top: {
Documentation: '/docs/',
Intro: '/docs/intro',
Install: '/docs/install',
Start: '/docs/begin',
Showcase: '/docs/showcase',
Plugins: '/docs/plugins',
Fund: '/donate/'
},
bottom: {
DocPad: '/',
GitHub: 'https://github.com/docpad/docpad',
Support: '/support',
Donate: '/donate/'
}
},
// -----------------------------
// Site Properties
site: {
// The production URL of our website
url: siteUrl,
// The default title of our website
title: 'DocPad - Streamlined Web Development',
// The website description (for SEO)
description: 'Empower your website frontends with layouts, meta-data, pre-processors (markdown, jade, coffeescript, etc.), partials, skeletons, file watching, querying, and an amazing plugin system. Use it either standalone, as a build script, or even as a module in a bigger system. Either way, DocPad will streamline your web development process allowing you to craft full-featured websites quicker than ever before.',
// The website keywords (for SEO) separated by commas
keywords: 'bevry, bevryme, balupton, benjamin lupton, docpad, node, node.js, javascript, coffeescript, query engine, queryengine, backbone.js, cson',
// Styles
styles: [
'//cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css',
'//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/xcode.min.css',
'/styles/style.css'
],
// Script
scripts: []
},
services: {
googleSearch: '000711355494423975011:mvl83obfzvq'
},
// heleprs
getLatestData () {
return require('./src/raw/vendor/latest.json')
},
getExchangeData () {
return require('./src/raw/vendor/exchange.json')
}
},
// =================================
// Collections
collections: {
partners (database) {
const query = { relativeOutDirPath: 'learn/docpad-documentation/docpad/partners' }
const sort = [{ filename: 1 }]
return database.findAllLive(query, sort).on('add', function (document) {
document.setMetaDefaults({ write: false })
})
}
},
// =================================
// Plugins
// Alias stylus highlighting to css and there is no inbuilt stylus support
plugins: {
downloader: {
downloads: [{
name: 'latest.json',
path: 'src/raw/vendor/latest.json',
url: 'https://helper.docpad.org/latest.json'
},
{
name: 'exchange.json',
path: 'src/raw/vendor/exchange.json',
url: `https://helper.docpad.org/exchange?version=${docpadVersion}`
},
{
name: 'Normalize CSS',
path: 'src/raw/vendor/normalize.css',
url: 'https://rawgit.com/h5bp/html5-boilerplate/5.3.0/dist/css/normalize.css'
},
{
name: 'Highlight.js XCode Theme',
path: 'src/raw/vendor/highlight.css',
url: 'https://rawgit.com/isagalaev/highlight.js/8.0/src/styles/xcode.css'
}]
},
repocloner: {
repos: [{
name: 'DocPad Documentation',
path: 'src/documents/learn/docpad-documentation/docpad',
url: 'https://github.com/docpad/documentation.git'
}]
},
cleanurls: {
// enable this for surge.sh deployment
// trailingSlashes: true,
// Common Redirects
simpleRedirects: {
// community
'/chat-guidelines': 'http://learn.bevry.me/community/chat-guidelines',
'/chat-logs': 'https://botbot.me/freenode/docpad/',
'/chat': 'https://discuss.bevry.me/tags/chat',
'/support-channels': 'https://discuss.bevry.me/t/official-bevry-support-channels/63',
'/issues': 'https://github.com/docpad/docpad/issues',
'/bug-report': '/support-channels',
'/forum': 'https://discuss.bevry.me/tags/docpad',
'/stackoverflow': 'https://discuss.bevry.me/t/official-stack-overflow-support/61/3',
'/donate': 'https://bevry.me/donate',
'/tos': 'https://bevry.me/tos',
'/terms': 'https://bevry.me/tos',
'/privacy': 'https://bevry.me/privacy',
'/github': 'https://github.com/docpad',
'/twitter': 'https://twitter.com/docpad',
'/reddit': 'https://www.reddit.com/r/docpad',
'/trello': 'https://bevry.me/trello',
// aliases
'/gittip-community': '/donate',
'/gittip': '/donate',
'/gratipay-community': '/donate',
'/gratipay': '/donate',
'/flattr': '/donate',
'/praise': 'https://twitter.com/docpad/favorites',
'/growl': 'http://growl.info/downloads',
'/plugins': '/docs/plugins',
'/upgrade': '/docs/upgrade',
'/install': '/docs/install',
'/troubleshoot': '/docs/troubleshoot',
'/partners': '/docs/support#support-consulting-partners',
'/docs/start': '/docs/begin',
'/docs/skeletons': '/docs/showcase#skeletons',
'/get-started': '/docs/overview',
// docpad
'/license': 'https://github.com/docpad/docpad/blob/master/LICENSE.md#readme',
'/changelog': 'https://github.com/docpad/docpad/blob/master/HISTORY.md#readme',
'/changes': '/changelog',
'/history': '/changelog',
// issues
'/unstable-node': 'https://github.com/docpad/docpad/issues/725',
'/render-early-via-include': 'https://github.com/docpad/docpad/issues/378',
'/extension-not-rendering': 'https://github.com/docpad/docpad/issues/192',
'/plugin-conventions': 'https://github.com/docpad/docpad/issues/313',
'/plugin-uncompiled': 'https://github.com/docpad/docpad/issues/925'
},
advancedRedirects: [
// Issues
// /(i|issue)[/#{issue}]
[/^\/(?:i|issues)\/(.+)$/, 'https://github.com/docpad/docpad/issues/$1'],
// Plugins
// /(p|plugin)/#{pluginName}
[/^\/(?:p|plugin)\/(.+)$/, 'https://github.com/docpad/docpad-plugin-$1']
]
}
}
}
// Apply our helpers to the docpad configuration
helpers({
config: {
getUrl ({ name }) {
return `/docs/${name}`
},
docs: {
title: 'Documentation',
url: '/docs/'
},
projects: {
docpad: {
editUrl: 'https://github.com/docpad/documentation/edit/master/',
title: 'DocPad',
url: '/',
categories: {
start: {
title: 'Getting Started'
},
community: {
title: 'Community'
},
core: {
title: 'Core'
},
extend: {
title: 'Extend'
}
}
}
}
},
docpadConfig
})
// Don't use debug log level on travis as it outputs too much and travis complains
// https://travis-ci.org/docpad/website/builds/104133494
if (process.env.TRAVIS) {
docpadConfig.logLevel = 6
}
// Export our DocPad Configuration
module.exports = docpadConfig