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.
 
 
 

132 lines
5.1 KiB

  1. =============
  2. Configuration
  3. =============
  4. Hyde is configured using one or more ``yaml`` files. On top of all the niceties
  5. ``yaml`` provides out of the box, Hyde also adds a few power features to manage
  6. complex websites.
  7. If a site has a ``site.yaml`` file in the root directory, it is used as the
  8. configuration for generating the website. This can be overridden by providing a
  9. command line option. See the `command line reference <CLI>`_ for details.
  10. Inheritance
  11. ===========
  12. Configuration files can inherit from another file using the ``extends`` option.
  13. For example, the following configuration will inherit all properties from
  14. ``site.yaml`` and override the ``mode`` property::
  15. extends: site.yaml
  16. mode: production
  17. This is useful for customizing the site to operate in different modes. For
  18. example, when running locally you may want your media files to come from
  19. ``/media`` but on production you may have a subdomain and want the media to
  20. come from ``http://abc.example.com/media``.
  21. This can be accomplished by creating an ``extended`` configuration file and
  22. overriding the ``media_url`` property.
  23. .. todo:: Add link to real example config.
  24. The following settings can be defined for use in templates:
  25. Paths & URLs
  26. ============
  27. +----------------+-----------------------------------------------------------+
  28. | ``media_root`` | The root path where media files (images, CSS, JavaScript, |
  29. | | etc.) can be found. This may be used by plugins for |
  30. | | special processing. If your website does not have a |
  31. | | folder that contains all media, you can safely omit this |
  32. | | property. Defaults to ``media``. |
  33. +----------------+-----------------------------------------------------------+
  34. | ``media_url`` | The url prefix for serving media files. If you are using |
  35. | | a CDN like Amazon S3 or the Rackspace cloud and host all |
  36. | | of your media files from there, you can make use of this |
  37. | | property to specify the prefix for all media files. |
  38. | | Defaults to ``/media``. |
  39. +----------------+-----------------------------------------------------------+
  40. | ``base_url`` | The base url from which the site is served. If you are |
  41. | | hosting the website in a subdomain or as part of a larger |
  42. | | website, you can specify this property to indicate the |
  43. | | path of this project in your website. Defaults to ``/``. |
  44. +----------------+-----------------------------------------------------------+
  45. Plugins and Templates
  46. =====================
  47. +--------------+--------------------------------------------------------------+
  48. | ``template`` | The template engine to use for processing the website can be |
  49. | | specified in the configuration file as a Python class path. |
  50. | | Currently, only ``Jinja2`` is supported. Reserved for future |
  51. | | use. Defaults to |
  52. | | ``hyde.ext.templates.jinja.jinja2template``. |
  53. +--------------+--------------------------------------------------------------+
  54. | ``plugins`` | Plugins are specified as list of Python class paths. Events |
  55. | | that are raised during the generation of the website are |
  56. | | issued to the plugins in the same order as they are listed |
  57. | | here. You can learn more about how the individual plugins |
  58. | | are configured in the `plugin documentation <plugins>`_. |
  59. | | Optional. By default, no plugins are enabled. |
  60. +--------------+--------------------------------------------------------------+
  61. .. _object-model:
  62. Context Data
  63. ============
  64. The context section contains key / value pairs that are simply passed on to the
  65. templates.
  66. For example, given the following configuration, the statement
  67. ``{{ app.current_version }}`` in any template will output ``0.6``::
  68. context:
  69. data:
  70. app:
  71. version: 0.6
  72. By default, no context variables are provided.
  73. Context Data Providers
  74. ======================
  75. Providers are special constructs used to import data into the context. For
  76. example, data from a database can be exported as ``yaml`` and imported as a
  77. provider. For example, the following snippets would import the data in
  78. ``app-versions.yaml`` into ``context[versions]``. This data can then be used
  79. directly in templates in this manner: ``{{ versions.latest }}``.
  80. .. TODO: Investigate code-block captions here. This feature was added in sphinx
  81. 1.3, but doc8 seems to not support that yet.
  82. .. code::
  83. # site.yaml
  84. context:
  85. providers:
  86. versions: app-versions.yaml
  87. .. code::
  88. # app-versions.yaml
  89. latest: 0.6
  90. Markdown
  91. ========
  92. Extensions and extension configuration for markdown can be configured in the
  93. ``markdown`` property. You can read about markdown extensions in the
  94. `Python-Markdown documentation <https://pythonhosted.org/Markdown/>`_.
  95. The following configuration will use the ``def_list``, ``tables``, ``headerid``
  96. extensions in Python-Markdown.