---
title: 'Processing Twig in Page Frontmatter?'
url: 'https://getgrav.org/forum/themes-styling/processing-twig-in-page-frontmatter-t4380'
markdown: 'https://getgrav.org/forum/themes-styling/processing-twig-in-page-frontmatter-t4380.md'
date: '2026-06-21'
description: "I've set the following in my site.yaml file: frontmatter: process_twig: true And am trying to calculate the URL for an image for Twitter Card data: metadata:"
---

[Themes & Styling](https://getgrav.org/forum/themes-styling)

#   Processing Twig in Page Frontmatter? 

 Solved by Paul Hibbitts [View solution](https://getgrav.org/forum/themes-styling/processing-twig-in-page-frontmatter-t4380#post-19567)

  Started by Paul Hibbitts 9 years ago · 1 replies · 1660 views    

 [9 years ago](https://getgrav.org/forum/themes-styling/processing-twig-in-page-frontmatter-t4380#post-19509 "Permalink") 

I've set the following in my site.yaml file:

```yaml
frontmatter:
process_twig: true
```

And am trying to calculate the URL for an image for Twitter Card data:

```
metadata:
'twitter:card' : summary
'twitter:site' : @hibbittsdesign
'twitter:title' : CMPT-363 Week 2 (Sep 13 - 19)
'twitter:description' : Week 2 Materials for CMPT 363 User Interface Design at Simon Fraser University
'twitter:image': page.media.images|first.absolute_url
```

However, the above does not work and if I add brackets, like this:

```twig
'twitter:image': {{ page.media.images|first.absolute_url }}
```

I get a Twig error, any ideas on if/how this could be done?

Thanks very much,
Paul

last edited 09/08/17 by Paul Hibbitts

 [9 years ago](https://getgrav.org/forum/themes-styling/processing-twig-in-page-frontmatter-t4380#post-19567 "Permalink")  Solution 

So, I've discovered two things: one is that this processing happens before page processing so I cannot use page functions, however I also learned how to make this work otherwise!

You need to include quotes around the Twig code, so for example:

```twig
    'twitter:image':  '{{ base_url_absolute }}{{ page.find(''/headerimage'').media.images|first.url(true) }}'
```

Also notice that if you need to use quotes in the Twig line itself, you need to double quote them.

 👍 2 

[Log in](https://getgrav.org/login?return=%2Fforum%2Fthemes-styling%2Fprocessing-twig-in-page-frontmatter-t4380) to reply.

###  Suggested topics

 | Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| [Grav2 with Quark2 – All pages in the hamburger-menu of a one-pager](https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by AH, 2 weeks ago |  | 1 | 199 | [10 hours ago](https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485 "by AH") |
| [\[quark\] mobile menu as the modular page menu](https://getgrav.org/forum/themes-styling/quark-mobile-menu-as-the-modular-page-menu-t1132)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by Bruno, 4 years ago |  | 6 | 1350 | [10 hours ago](https://getgrav.org/forum/themes-styling/quark-mobile-menu-as-the-modular-page-menu-t1132 "by AH") |
| [Modular Page Background Image Display](https://getgrav.org/forum/themes-styling/modular-page-background-image-display-t9486)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by TomW, 2 weeks ago |  | 2 | 203 | [2 days ago](https://getgrav.org/forum/themes-styling/modular-page-background-image-display-t9486 "by TomW") |
| [Inheriting a Theme does not quite work correctly](https://getgrav.org/forum/themes-styling/inheriting-a-theme-does-not-quite-work-correctly-t9501)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by themetman, 3 days ago |  | 0 | 56 | [3 days ago](https://getgrav.org/forum/themes-styling/inheriting-a-theme-does-not-quite-work-correctly-t9501 "by themetman") |
| [Is it a way to get the "content - summary" in a twig template ?](https://getgrav.org/forum/themes-styling/is-it-a-way-to-get-the-content-summary-in-a-twig-template-t9431)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by FrViPofm, 2 months ago |  | 4 | 668 | [1 month ago](https://getgrav.org/forum/themes-styling/is-it-a-way-to-get-the-content-summary-in-a-twig-template-t9431 "by Paul Hibbitts") |
