Nibble 0.25.0
One way to bring content in, wherever a page needs it. The queries a view’s sidecar runs now work for layouts, for the page’s own linked records, and for a form’s choices.
One database migration adds a column for the labels a submission was made with; it only adds, so it can be rolled back, but the snapshot taken before an upgrade is the surest way back.
What’s new
- A layout can query content.
layouts/<name>.ymlis a sidecar like a view’s, and its props reach every page using the layout, the 404, search and preview pages included, typed asLayoutProps. A layout that shares another’s header takes its queries withextends: default.nibble:checkrefuses a layout query named like a view’s or like a prop every page has. - A page brings its linked records along.
page: { include: [loan] }in a view’s or layout’s sidecar gives the page’s relationship fields as whole records, so a view or layout reads the fields of what the page links to. - Child entries in a query.
include: [children]on a structured collection gives each entry its published children in tree order, enough for a menu of sections and their pages. - A form’s choices can come from content. A
select,radio,checkboxesorbutton_groupfield on a form takesoptions: { from: entries:<collection> }(orterms:), withvalue,label,whereandsort. Only published entries in the visitor’s language are offered and accepted.parent:narrows one field’s choices by the answer to another, through the tree or a relationship field, and the@nibbleform helper hides choices that don’t fit and clears one that stops fitting. - Submissions keep their choices readable. Each choice’s label is stored with the submission, so the Control Plane, emails and exports still show it after the option is renamed or removed; an encrypted field’s labels are encrypted too.
- Generated types follow
include. An included field is typed as the record it holds, andchildrenas the collection’s records.
What’s fixed
- A crop shows wherever the image is used. An image whose field has no
presetwas served as uploaded, with its uploaded size, so cropping, rotating or flipping it in the media library changed only its preset uses. Every use now shows the edited image at its edited size, and Reset brings the original back everywhere. The crop editor and Download in the Control Plane still work from the original. An animated image can’t be edited, since its uses would show a single frame; one edited before keeps being served as uploaded.
Changed
- crumbs lists topics in its footer from a layout query, and a post shows its author’s bio.
- An image that already has edits gets a new address, so a cache holding its original under the old one can’t keep serving it; the old address redirects.