Select from Query

Select from Query #

Quiqr version >= 0.16.0

The select-from-query field generates a dropdown selectbox for selecting strings generated by an query string.


Properties #

propertyvalue typeoptionaldescription
keystringmandatoryKeys are for internal use and must be unique
titlestringoptionalThe title of the element
tipstringoptional (default: null)Text entered here with markdown formatting is displayed as context help in an overlay box
defaultstring OR array of stringsoptional (default: null)default value when the key is not set yet
multiplebooleanoptional (default: false)Enable multiple selection
autoSavebooleanoptional (default: false)Form data is automatically saved after changing the value
query_globstringmandatoryGlob string to select one or more files
query_stringstringmandatorystring to use on one the of the query types

Example 1 #

This example shows a simple query.

Configuration #

default: 2
key: sample_field
multiple: false
query_glob: data/system_data.json
query_string: .weekday[]
title: Sample field
type: select-from-query
default = 2
key = "sample_field"
multiple = false
query_glob = "data/system_data.json"
query_string = ".weekday[]"
title = "Sample field"
type = "select-from-query"
   "default": 2,
   "key": "sample_field",
   "multiple": false,
   "query_glob": "data/system_data.json",
   "query_string": ".weekday[]",
   "title": "Sample field",
   "type": "select-from-query"

Output #


  • Monday
  • Tuesday

possible frontmatter result

sample_field: Monday

Query Language #

The Quiqr Query Language is inspired by JQ, but has some additions specially suited for querying the Hugo content. Currently this page contains all information about QQL.

QQL selects data or metadata from markdown/json/yaml/toml files.

In the select-from-quert field, only results in the form of arrays with strings are valid. Other results types wil produce an error message.

At time of writing QQL only exists in this document. QQL is in a very early development phase.

When the query_string starts with # the file meta data will be queried. When the query_string starts with . the file content data will be queried.

Meta data functions #

  • file_name: returns the full filename-component. e.g.
  • file_base_name: returns the filename with out extension. e.g. blog-about-quiqr
  • parent_dir: returns the parent directory of the found filename with out extension. e.g. the-post when the filename is a bundle posts/the-post/

Populating select option with filenames from a directory. #

query_glob: content/resources/*.md
query_string: #file_name[]

Populating select option with titles from front matter from multiple directories. #

query_glob: content/**/*.md
query_string: .title[]

Known issues #