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.

117 lines
3.5 KiB

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