A fork of hyde, the static site generation. Some patches will be pushed upstream.
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.
 
 
 

161 lines
4.9 KiB

  1. ===
  2. title: Configuration
  3. subtitle: change hyde to match your style
  4. created: 2011-01-28 01:30:05
  5. ===
  6. §§ blurb
  7. Hyde is configured using one or more `yaml` files. On top of all
  8. the niceties `yaml` provides out of the box, hyde also adds a few
  9. power features to manage complex websites.
  10. If a site has a `site.yaml` file in the root directory it is used
  11. as the configuration for generating the website. This can be
  12. overridden by providing a command line option. See the
  13. [command line reference][commandline] for details.
  14. §§ /blurb
  15. ## Inheritance
  16. Configuration files can inherit from another file using the
  17. `extends` option.
  18. For example, the following configuration will inherit all properties
  19. from `site.yaml` and override the `mode` property.
  20. ~~~yaml~~~
  21. extends: site.yaml
  22. mode: production
  23. ~~~~~~~~~~
  24. This is useful for customizing the site to operate in different modes.
  25. For example, when running locally you may want your media files to
  26. come from `/media` but on production you may have a subdomain and want
  27. the media to come from `http://abc.example.com/media`.
  28. This can be accomplished by creating an _extended_ configuration file and
  29. overriding the media_url property. For a real world example, you can take
  30. a look at the [source of this documentation][hydedocpages].
  31. ## Paths & Urls
  32. The following path & url properties can be defined for use in templates:
  33. `media_root`
  34. : The root path where media files(images, css, javascript etc.,)
  35. can be found. This may be used by plugins for special processing.
  36. If your website does not have a folder that contains all media,
  37. you can safely omit this property.
  38. _Optional_. Default: `media`
  39. `media_url`
  40. : The url prefix for serving media files. If you are using a CDN like
  41. Amazon S3 or the Rackspace cloud and host all your media files from
  42. there, you can make use of this property to specify the prefix for
  43. all media files.
  44. _Optional_. Default: `/media`
  45. `base_url`
  46. : The base url from which the site is served. If you are hosting the
  47. website in a subdomain or as part of a larger website, you can specify
  48. this property to indicate the path of this project in your website.
  49. _Optional_. Default: `/`
  50. `deploy_root`
  51. : Where the generated files should go. This can either be a relative
  52. path from the root of the site source or an absolute path. Note that
  53. this can also be overridden in the [command line][commandline] using
  54. the `-d` option.
  55. ## Plugins & templates
  56. `template`
  57. : The template engine to use for processing the website can be specified
  58. in the configuration file as a python class path. Currently no other
  59. templates apart from `Jinja2` are supported, so the `template` setting
  60. is a NOOP at the moment.
  61. _Optional_. Default: `hyde.ext.templates.jinja.Jinja2Template`
  62. `plugins`
  63. : Plugins are specified as list of python class paths. Events that are
  64. raised during the generation of the website are issued to the plugins
  65. in the same order as they are listed here. You can learn more about
  66. how the individual plugins themselves are configured in the
  67. [plugin documentation][plugins].
  68. _Optional_. Default: No plugins are loaded.
  69. The following configuration option would load the metadata plugin
  70. and the blockdown plugin and execute events in the same order.
  71. ~~~yaml~~~
  72. plugins:
  73. - hyde.ext.plugins.meta.MetaPlugin
  74. - hyde.ext.plugins.blockdown.BlockdownPlugin
  75. ~~~~~~~~~~~
  76. ## Context
  77. The context section contains key / value pairs that are simply passed
  78. on to the templates
  79. _Optional_. Default: No context variables are defined.
  80. For example, given the following configuration, the statement
  81. `{%raw%}{{hyde.current_version}}{%endraw%}` in any template
  82. will output `0.6`.
  83. ~~~yaml~~~
  84. context:
  85. hyde:
  86. current_version: 0.6
  87. ~~~~~~~~~~~
  88. ## Providers
  89. Providers are special constructs used to import data into the context.
  90. For example, data from a database can be exported as `yaml` and imported
  91. as providers.
  92. For example, consider the following snippet:
  93. ~~~yaml~~~
  94. context:
  95. providers:
  96. versions: hyde-versions.yaml
  97. ~~~~~~~~~~~
  98. This would import the data in `hyde-versions.yaml` into `context[versions]`.
  99. This data can be used directly in templates in this manner:
  100. `{%raw%}{{ versions.latest }}{%endraw%}`.
  101. ## Markdown
  102. Extensions and extension configuration for markdown can be configured in the
  103. `markdown` property. You can read about markdown extensions in
  104. [python markdown documentation][pymarkdown].
  105. The following configuration:
  106. ~~~yaml~~~
  107. markdown:
  108. extensions:
  109. - def_list
  110. - tables
  111. - headerid
  112. ~~~~~~~~~~
  113. will use the def_list, tables and headerid extensions in python markdown.
  114. [commandline]: [[commandline.html]]
  115. [plugins]: [[plugins.html]]
  116. [pymarkdown]: http://www.freewisdom.org/projects/python-markdown/Available_Extensions
  117. [hydedocpages]: https://github.com/hyde/hyde/blob/master/hyde/layouts/doc/pages.yaml