alphagov / govuk-prototype-kit-docs

Site for the GOV.UK Prototype Kit
https://prototype-kit.service.gov.uk/docs
MIT License
3 stars 2 forks source link

Adding conditional content guidance to tutorials #107

Closed harrythompsondwp closed 1 year ago

harrythompsondwp commented 1 year ago

Suggestion

Using condition content

As far as I can see there's no good guidance on using conditional content, using nunjucks syntax. But I've used and seen it used in quite a few GDS prototypes, and had to teach myself how to do it. I've written the attached guide for colleagues at Opencast, but I figure this would be a useful addition to the tutorials section of the kit. Happy for any of it to be adapted, but something along these lines would be helpful to include! Conditional content.pdf

harrythompsondwp commented 1 year ago

Updated version attached with better guidance on data notation. i.e. {{data['name']}} is better than {{data.name}} as it allows for hyphens in the name tag. Conditional content v2.pdf

joelanman commented 1 year ago

related: #110

joelanman commented 1 year ago

I think we now have most of this in our guides:

Thanks @harrythompsondwp for the issue and the content!