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