Inline docs: Use Twig's array literal rather than the split filter for sort_by

pico-3.0-alpha
Daniel Rudolf 9 years ago
parent dedb09d3e9
commit cdba66b951
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
  1. 10
      content-sample/index.md

@ -227,12 +227,12 @@ Additional to Twigs extensive list of filters, functions and tags, Pico also
provides some useful additional filters to make theming easier. You can parse provides some useful additional filters to make theming easier. You can parse
any Markdown string to HTML using the `markdown` filter. Arrays can be sorted any Markdown string to HTML using the `markdown` filter. Arrays can be sorted
by one of its keys or a arbitrary deep sub-key using the `sort_by` filter by one of its keys or a arbitrary deep sub-key using the `sort_by` filter
(e.g. `{% for page in pages|sort_by("meta:nav"|split(":")) %}...{% endfor %}` (e.g. `{% for page in pages|sort_by([ 'meta', 'nav' ]) %}...{% endfor %}`
iterates through all pages, ordered by the `nav` meta header; please note the iterates through all pages, ordered by the `nav` meta header; please note the
`"meta:nav"|split(":")` part of the example, which passes `['meta', 'nav']` to `[ 'meta', 'nav' ]` part of the example, it instructs Pico to sort by
the filter describing a key path). You can return all values of a given key or `page.meta.nav`). You can return all values of a given key or key path of an
key path of an array using the `map` filter (e.g. `{{ pages|map("title") }}` array using the `map` filter (e.g. `{{ pages|map("title") }}` returns all
returns all page titles). page titles).
You can use different templates for different content files by specifying the You can use different templates for different content files by specifying the
`Template` meta header. Simply add e.g. `Template: blog-post` to a content file `Template` meta header. Simply add e.g. `Template: blog-post` to a content file

Loading…
Cancel
Save