-
Notifications
You must be signed in to change notification settings - Fork 0
/
docpad.coffee
42 lines (35 loc) · 1.34 KB
/
docpad.coffee
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
# DocPad Configuration File
# http://docpad.org/docs/config
moment = require 'moment'
moment.locale 'fr'
# Define the DocPad Configuration
docpadConfig = {
prompts: false # default
templateData:
site:
url: "https://lesdoigtsdehors.org"
title: "LDD (ex JSLDD)"
long_title: "Les Doigts Dehors"
getPreparedTitle: -> if @document.title then "#{@document.title} - #{@site.title}" else @site.long_title
formatDate: (date, format="DD MMMM YYYY") ->
moment(date).format(format)
dateIso: (date) ->
moment(date).toISOString()
dateICS: (date, format="YYYYMMDDTHHmmss[Z]") ->
moment(date).format(format)
probableNextEditionDate: ->
oneMonthAfterLastEdition = moment(@getCollection('previousEditions').at(0).get('date')).add('M', 1)
if oneMonthAfterLastEdition.toDate() > new Date() then oneMonthAfterLastEdition.toISOString() else moment().toISOString()
collections:
editions: ->
@getCollection('html').findAllLive({layout: 'edition'}, [date:-1])
previousEditions: ->
@getCollection('html').findAllLive({layout: 'edition', date: $lt: moment()}, [date:-1])
nextEditions: ->
@getCollection('html').findAllLive({layout: 'edition', date: $gt: moment()})
plugins:
nodesass:
debugInfo: false
}
# Export the DocPad Configuration
module.exports = docpadConfig