# Tutorial: Global field definitions aka blueprint snippets

**URL:** <https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820>\
**Category:** Questions\
**Tags:** v2\
**Created:** [December 14, 2015, 12:51pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820 "2015-12-14T12:51:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![cirstenkot](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/cirstenkot/32/1591_2.png) [@cirstenkot](https://forum.getkirby.com/u/cirstenkot)\
**Post date:** [December 14, 2015, 12:51pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/1 "2015-12-14T12:51:32Z")

</div>

Hi People,

Is there a small tutorial for the noobs 😉 Or can we (uhm well not me) write one?

How to use the Global field option.

Step 1) add the folder site/blueprints/fields  
Step2) made it to step one so far.

Need some help. For example how to (re)use it in your blueprint, and how to set up the yml file.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 14, 2015, 1:23pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/2 "2015-12-14T13:23:16Z")

</div>

This is the basic way of doing it:

1. Create the folder site/blueprints/fields.
2. Create a field definition, e.g. a date field in `date.yml`

```nohighlight
# /site/blueprints/fields/date.yml
label: Date
type: date
default: now

```

or an image select field in `imageselect.yml`

```nohighlight
# /site/blueprints/fields/imageselect.yml
label: Select an image
type: select
options: images

```

1. Reference the snippet in your blueprint, e.g.

```nohighlight
# /site/blueprints/mypage.yml
…
fields: 
  title: 
    label: Title
    type: text
  date: date
  myimage: imageselect

```

Or if you want to give your fields another label or change the default, you can extend it like this:

```php
# /site/blueprints/mypage.yml
…
fields: 
  title: 
    label: Title
    type: text
  date: 
    extends: date
    label: Published
    default: false
  myimage: 
   extends: imageselect
   label: Cover Image

```

---

<div class="post-metadata">

**Author:** ![cirstenkot](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/cirstenkot/32/1591_2.png) [@cirstenkot](https://forum.getkirby.com/u/cirstenkot)\
**Post date:** [December 14, 2015, 4:32pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/3 "2015-12-14T16:32:21Z")

</div>

Tnx a lot! I just misunderstood the way to call them. This is great!

---

<div class="post-metadata">

**Author:** ![italiafirenze](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/italiafirenze/32/1297_2.png) [@italiafirenze](https://forum.getkirby.com/u/italiafirenze)\
**Post date:** [December 14, 2015, 4:39pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/4 "2015-12-14T16:39:31Z")

</div>

Are my blueprints supposed to be yaml files? Mine are PHP?

---

<div class="post-metadata">

**Author:** ![cirstenkot](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/cirstenkot/32/1591_2.png) [@cirstenkot](https://forum.getkirby.com/u/cirstenkot)\
**Post date:** [December 14, 2015, 4:41pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/5 "2015-12-14T16:41:24Z")

</div>

hi, no only your so called blueprint snippets need te be .yml

---

<div class="post-metadata">

**Author:** ![jakobploens](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jakobploens/32/1315_2.png) [@jakobploens](https://forum.getkirby.com/u/jakobploens)\
**Post date:** [December 14, 2015, 5:25pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/6 "2015-12-14T17:25:35Z")

</div>

Blueprints can be both, PHP and YAML, since Kirby 2.2. So no problems here 😄

---

<div class="post-metadata">

**Author:** ![cirstenkot](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/cirstenkot/32/1591_2.png) [@cirstenkot](https://forum.getkirby.com/u/cirstenkot)\
**Post date:** [December 14, 2015, 6:19pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/7 "2015-12-14T18:19:47Z")

</div>

o yes I am sorry! haha!

---

<div class="post-metadata">

**Author:** ![italiafirenze](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/italiafirenze/32/1297_2.png) [@italiafirenze](https://forum.getkirby.com/u/italiafirenze)\
**Post date:** [December 14, 2015, 9:21pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/8 "2015-12-14T21:21:15Z")

</div>

I think I’d rather make my blueprints YAML because it can get tricky having so many php files with exactly the same name open in Coda.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [December 15, 2015, 12:53pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/9 "2015-12-15T12:53:27Z")

</div>

> [@texnixe](#):
>
> date

How can i extends multiple fields instead of single like that: `fields/meta.php`

```
fields:
	pageSeo:
		label: Meta Headings
		type: headline
	meta_title:
		label: Meta Title
		type: text
	meta_description:
		label: Meta Description
		type: textarea
	meta_keywords:
		label: Meta Keywords
		type: tags

```

---

<div class="post-metadata">

**Author:** ![jevets](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jevets/32/978_2.png) [@jevets](https://forum.getkirby.com/u/jevets)\
**Post date:** [December 15, 2015, 6:01pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/10 "2015-12-15T18:01:07Z")

</div>

@byybora I don’t think this is available. I’ve tried this, too, but couldn’t get it working.

It would be a nice feature to have, however overriding a single field may be difficult.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [December 15, 2015, 8:06pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/11 "2015-12-15T20:06:52Z")

</div>

@jevets i tried too but couldnt achive 🙂

---

<div class="post-metadata">

**Author:** ![thewebprojects](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/thewebprojects/32/10107_2.png) [@thewebprojects](https://forum.getkirby.com/u/thewebprojects)\
**Post date:** [March 15, 2016, 2:46pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/12 "2016-03-15T14:46:53Z")

</div>

It doesn’t seem to be possible to create a global field definition for a group of fields (e.g. 1 file that defines multiple fields). I understand extending a group would be akward/not possible, but i’m not interested in extending it. The power to add to the global group or make edits to the group which would then be reflected for every blueprint that calls it would be very useful.

Is it possible to define multiple fields in one global field definition file?

I tried and it doesn’t seem to be, but I’m not going to rule out that I did something wrong. I’d like to confirm this with the pros here.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [March 15, 2016, 4:03pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/13 "2016-03-15T16:03:07Z")

</div>

This has been requested before, check out this post: [Blueprint groups](https://forum.getkirby.com/t/blueprint-groups/3406)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 24, 2016, 8:41am UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/15 "2016-05-24T08:41:06Z")

</div>

Well, since Kirby now has [global field definitions](https://getkirby.com/docs/panel/blueprints/global-field-definitions), that makes it even easier to include those and even extend them in your blueprints, even if you use the .yml extension instead of .php.

---

<div class="post-metadata">

**Author:** ![monobasic](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/monobasic/32/1035_2.png) [@monobasic](https://forum.getkirby.com/u/monobasic)\
**Post date:** [May 24, 2016, 8:47am UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/16 "2016-05-24T08:47:39Z")

</div>

These are great, but I currently miss the option to include groups of fields… not a big issue tho 🙂

---

<div class="post-metadata">

**Author:** ![lukehatfield](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukehatfield/32/386_2.png) [@lukehatfield](https://forum.getkirby.com/u/lukehatfield)\
**Post date:** [December 11, 2016, 3:42am UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/17 "2016-12-11T03:42:03Z")

</div>

I also appreciate the global fields and at the same time see a use for global _groups of fields_. Would this be hard to implement?

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:53pm UTC](https://forum.getkirby.com/t/tutorial-global-field-definitions-aka-blueprint-snippets/2820/18 "2025-02-06T16:53:09Z")

</div>


