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.
 
 
 

60 lines
2.0 KiB

  1. =========
  2. Templates
  3. =========
  4. Creating Layouts
  5. ================
  6. Hyde is designed to support more than one template language for creating
  7. layouts, however, it currently only supports `Jinja2
  8. <http://jinja.pocoo.org>`_. This section of the documentation will focus on
  9. creating templates using Jinja2. If you are not familiar with Jinja2, it's a
  10. good idea to go through the `most excellent Jinja2 documentation
  11. <http://jinja.pocoo.org/docs/dev/templates/>`_.
  12. Site Structure
  13. ==============
  14. Hyde encourages separation of content from layout. The following shows a
  15. typical structure of a Hyde website::
  16. ├── content/
  17. │   ├── about.html
  18. │   ├── blog/
  19. │   ├── index.html
  20. │   ├── layout/
  21. │   │   ├── base.j2
  22. │   │   └── macros.j2
  23. │   ├── media/
  24. │   │   ├── css/
  25. │   │   ├── images/
  26. │   │   └── js/
  27. │   ├── portfolio/
  28. │   └── projects/
  29. └── site.yml
  30. good objective is to have all the files in content contain as little layout as
  31. possible and be written with a text oriented markup language like `markdown
  32. <https://daringfireball.net/projects/markdown/>`_. While its not always
  33. possible to achieve 100% separation, hyde provides several nice tools to get
  34. very close to that goal.
  35. Context Variables
  36. =================
  37. Hyde by default makes the following variables available for templates:
  38. - ``site``: Represents the container object of the entire site.
  39. - ``node``: The node (folder) where the current file resides.
  40. - ``resource``: The resource (file) that is currently being processed.
  41. - Context variables: all variables defined under the ``context`` section of the
  42. site configuration are available to the templates.
  43. Read more information about the ``site``, ``node``, and ``resource`` variables
  44. in the `site model documentation <#>`_.
  45. Read more information about context variables in the `configuration
  46. documentation <#config>`_.