You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.5 KiB

  1. # The DocPad Configuration File
  2. # It is simply a CoffeeScript Object which is parsed by CSON
  3. docpadConfig = {
  4. srcPath : './server'
  5. outPath: './docs'
  6. # =================================
  7. # Template Data
  8. # These are variables that will be accessible via our templates
  9. # To access one of these within our templates, refer to the FAQ: https://github.com/bevry/docpad/wiki/FAQ
  10. templateData:
  11. # Specify some site properties
  12. site:
  13. # The production url of our website
  14. url: "http://www.semantic-ui.com"
  15. # Here are some old site urls that you would like to redirect from
  16. oldUrls: [
  17. 'learnsemantic.com'
  18. ],
  19. # The default title of our website
  20. title: "Semantic UI"
  21. # The website description (for SEO)
  22. description: """
  23. Semantic empowers designers and developers by creating a shared vocabulary for UI.
  24. """
  25. # The website keywords (for SEO) separated by commas
  26. keywords: """
  27. html5, ui, library, framework, javascript
  28. """
  29. # -----------------------------
  30. # Helper Functions
  31. # Get the prepared site/document title
  32. # Often we would like to specify particular formatting to our page's title
  33. # we can apply that formatting here
  34. getPreparedTitle: ->
  35. # if we have a document title, then we should use that and suffix the site's title onto it
  36. if @document.title
  37. "#{@document.title} | #{@site.title}"
  38. # if our document does not have it's own title, then we should just use the site's title
  39. else
  40. @site.title
  41. getPage: (collection, id) ->
  42. for item, index in collection
  43. selectedIndex = (index + 1) if item.id is id
  44. selectedIndex
  45. pageCount: (collection) ->
  46. for item, index in collection
  47. itemCount = index + 1
  48. itemCount
  49. getPageCollection: (collection, id, delta = 2) ->
  50. for item, index in collection
  51. selectedIndex = index if item.id is id
  52. lastIndex = index
  53. # determine page count before and after
  54. bottomCount = if (selectedIndex - delta >= 0) then delta else (selectedIndex)
  55. topCount = if (selectedIndex + delta <= lastIndex) then delta else (lastIndex - selectedIndex)
  56. bottomDelta = (delta * 2 - topCount)
  57. topDelta = (delta * 2 - bottomCount)
  58. bottomIndex = if (selectedIndex - bottomDelta >= 0) then (selectedIndex - bottomDelta) else 0
  59. topIndex = if (selectedIndex + topDelta <= lastIndex) then (selectedIndex + topDelta) else lastIndex
  60. result = collection[bottomIndex..topIndex]
  61. result
  62. # Get the prepared site/document description
  63. getPreparedDescription: ->
  64. # if we have a document description, then we should use that, otherwise use the site's description
  65. @document.description or @site.description
  66. # Get the prepared site/document keywords
  67. getPreparedKeywords: ->
  68. # Merge the document keywords with the site keywords
  69. @site.keywords.concat(@document.keywords or []).join(', ')
  70. # =================================
  71. # Custom Collections
  72. collections:
  73. uiElements: ->
  74. @getCollection("documents").findAllLive({type: $in: ['UI Element']}, [{title: 1}])
  75. uiCollections: ->
  76. @getCollection("documents").findAllLive({type: $in: ['UI Collection']}, [{title: 1}])
  77. uiViews: ->
  78. @getCollection("documents").findAllLive({type: $in: ['UI View']}, [{title: 1}])
  79. uiModules: ->
  80. @getCollection("documents").findAllLive({type: $in: ['UI Module', 'UI Behavior']}, [{title: 1}])
  81. # =================================
  82. # DocPad Events
  83. # Here we can define handlers for events that DocPad fires
  84. # You can find a full listing of events on the DocPad Wiki
  85. # events:
  86. }
  87. # Export our DocPad Configuration
  88. module.exports = docpadConfig