# Nested structure defaults?

**URL:** <https://forum.getkirby.com/t/nested-structure-defaults/21150>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 10, 2021, 3:45pm UTC](https://forum.getkirby.com/t/nested-structure-defaults/21150 "2021-02-10T15:45:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gork](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gork/32/8110_2.png) [@gork](https://forum.getkirby.com/u/gork)\
**Post date:** [February 10, 2021, 3:45pm UTC](https://forum.getkirby.com/t/nested-structure-defaults/21150/1 "2021-02-10T15:45:40Z")

</div>

Heya

quick question: is it possible to create defaults in nested structures?  
I know of

```auto
 emails:
     label: Emails
     type: structure
     default:
       - email: bastian@getkirby.com
       - email: lukas@getkirby.com
       - email: nico@getkirby.com
       - email: sonja@getkirby.com
     fields:
       email:
         label: Email
         type: email

```

But how do I achieve this for nested lists?  
Thanks

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [February 10, 2021, 4:05pm UTC](https://forum.getkirby.com/t/nested-structure-defaults/21150/2 "2021-02-10T16:05:13Z")

</div>

I don’t think thats possible, you could, prefill the structure at page creation using a hook.

---

<div class="post-metadata">

**Author:** ![gork](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/gork/32/8110_2.png) [@gork](https://forum.getkirby.com/u/gork)\
**Post date:** [February 17, 2021, 1:23pm UTC](https://forum.getkirby.com/t/nested-structure-defaults/21150/3 "2021-02-17T13:23:38Z")

</div>

Just for future reference, here’s what I did for a nested structure

```auto
# blueprint
attributes:
  label: Attributes
  type: structure
  translate: false
  fields:
    autoid:
      type: hidden
      translate: false
    block:
      label: Block
      type: text
    items:
      label: Attribute
      type: structure
      fields:
        autoid:
          type: hidden
          translate: false
        block:
          label: Block
          type: text

```

```auto
# config.php

return [
    'hooks' => [
        'page.create:after' => function ($page, $input) {
            if($page->intendedTemplate() == 'model') {
            	$site = $this->site();
            	$_attributes = $site->find('products')->attributes()->yaml();

            	foreach ($_attributes as $akey => $block) {
            		unset($_attributes[$akey]['autoid']);
            		foreach ($block['items'] as $bkey => $items) {
            			unset($_attributes[$akey]['items'][$bkey]['autoid']);
            			$_attributes[$akey]['items'][$bkey]['name'] = '';
            		}
            	}

            	$page->update(['attributes' => yaml::encode($_attributes)]);
            }
        }
    ]
];

```

afaik it could’ve been done without `unset`ing `autoid` or setting `name` to be an empty string, but I prefer a clean `.txt` file
