hugo/docs/content/extras/dynamiccontent.md
2015-02-17 12:14:39 -05:00

1.1 KiB

aliases date menu next prev title weight
/doc/dynamiccontent/
2015-02-14
main
parent
extras
/extras/highlighting /extras/datafiles Dynamic Content 91

Dynamic content with a static site generator? Yes it is possible!

In addition to the built-in variables available from Hugo, you can specify your own custom data that can be accessed via templates or shortcodes.

Hugo supports loading data from YAML, JSON, and TOML files located in the data directory.

It even works with LiveReload.

The Data Folder

As explained in Source Organization, the data folder is where you can store additional data for Hugo to use when generating your site. These files must be YAML, JSON or TOML files (using either the .yml, .yaml, .json or toml extension) and the data will be accessible as a map in .Site.Data.

The keys in this map will be a dot chained set of path, filename and key in file (if applicable).

This is best explained with an example: