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.

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