From a883531baddb3b50d8ab254d7b126fabd2bc3ba4 Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Sun, 10 Jan 2016 15:35:37 -0500 Subject: [PATCH] Document new Query.distinct method. --- .../docs/api/db/query/distinct/contents.lr | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 content/docs/api/db/query/distinct/contents.lr diff --git a/content/docs/api/db/query/distinct/contents.lr b/content/docs/api/db/query/distinct/contents.lr new file mode 100644 index 00000000..37630782 --- /dev/null +++ b/content/docs/api/db/query/distinct/contents.lr @@ -0,0 +1,37 @@ +title: distinct +--- +summary: Returns the set of unique values for a field. +--- +type: method +--- +signature: field_name +--- +body: + +Returns a `set` with all values for `field_name` of all +[Records :ref](../../record/) in this query. + +## Example + +If your blog posts have a field called `tags`: + +```ini +# blog-post.ini + +[field.tags] +name = Tags +type = strings +``` + +You can display all your blog posts' tags with: + +```html+jinja +{% set tags = site.query('/blog').distinct('tags') %} +{% if tags %} + +{% endif %} +```