Converting a legacy theme
Siteleaf v2 themes use similar Liquid-based templates as v1, with some minor differences that you should be aware of.
v1 | v2 |
---|---|
{% include "includes/header" %} |
{% include header.html %} |
{{ body }} |
{{ content }} |
{{ current }} |
{{ page }} |
{{ title }} |
{{ page.title }} |
{{ url }} |
{{ page.url }} |
{{ taxonomy.categories }} |
{{ page.categories }} |
{{ taxonomy.tags }} |
{{ page.tags }} |
{{ meta.key }} or {{ meta["key"] }} |
{{ page.key }} or {{ page["key"] }} |
{{ site.meta.key }} |
{{ site.key }} |
{{ site.pages }} |
{{ site.html_pages }} |
{{ thing | fallback: "foobar" }} |
{{ thing | default: "foobar" }} |
{{ thing | markdown }} |
{{ thing | markdownify }} |
{{ thing | slug }} |
{{ thing | slugify }} |
Assets
In v1 you could have assets
attached to a piece of content (i.e. page.assets
). This is no longer supported by default however you can add this functionality using the new List metadata field option in v2. To do so, create a new List metadata field called assets
then add your files to the list. In your template, you can then loop through page.assets
to access the paths to each asset. This field could also be called images
or files
. Read more.