# \[SOLVED\] How to access page variables defined in the front matter?

**URL:** <https://discourse.gohugo.io/t/solved-how-to-access-page-variables-defined-in-the-front-matter/6398>\
**Category:** support\
**Created:** [April 30, 2017, 4:02pm UTC](https://discourse.gohugo.io/t/solved-how-to-access-page-variables-defined-in-the-front-matter/6398 "2017-04-30T16:02:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![code2pro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/code2pro/32/3114_2.png) [@code2pro](https://discourse.gohugo.io/u/code2pro)\
**Post date:** [April 30, 2017, 4:02pm UTC](https://discourse.gohugo.io/t/solved-how-to-access-page-variables-defined-in-the-front-matter/6398/1 "2017-04-30T16:02:35Z")

</div>

Hi, I have some variables in the front matter of a page (`post/my-post.md`):

```auto
+++
...
thumbnail = "/pimages/00002-travel-mountain-top.jpg"
whatever = "/pimages/00002-travel-mountain-top.jpg"
...
+++

```

I could not obtain their values in the `layouts/partials/head.html`:

```auto
    {{ if $.Page.Params.whatever }}
    <meta property="og:image" content="{{ .Site.BaseURL }}{{ $.Page.Params.whatever }}">
    {{ end }}

    {{ if .Params.whatever }}
    <meta property="og:image" content="{{ .Site.BaseURL }}{{ .Params.whatever }}">
    {{ end }}

    {{ if $.Params.whatever }}
    <meta property="og:image" content="{{ .Site.BaseURL }}{{ $.Params.whatever }}">
    {{ end }}

```

I did googling, searched the forum and the docs but could not find any solution that works for me. Please help. Thanks

---

<div class="post-metadata">

**Author:** ![tanzaho](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tanzaho/32/142_2.png) [@tanzaho](https://discourse.gohugo.io/u/tanzaho)\
**Post date:** [April 30, 2017, 4:28pm UTC](https://discourse.gohugo.io/t/solved-how-to-access-page-variables-defined-in-the-front-matter/6398/2 "2017-04-30T16:28:57Z")

</div>

The second version should be working…  
At least this is the syntax I’m using in my template.

---

<div class="post-metadata">

**Author:** ![code2pro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/code2pro/32/3114_2.png) [@code2pro](https://discourse.gohugo.io/u/code2pro)\
**Post date:** [April 30, 2017, 4:29pm UTC](https://discourse.gohugo.io/t/solved-how-to-access-page-variables-defined-in-the-front-matter/6398/3 "2017-04-30T16:29:21Z")

</div>

Thanks! Let me try again. There must be something wrong on my side.

---

<div class="post-metadata">

**Author:** ![code2pro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/code2pro/32/3114_2.png) [@code2pro](https://discourse.gohugo.io/u/code2pro)\
**Post date:** [April 30, 2017, 4:43pm UTC](https://discourse.gohugo.io/t/solved-how-to-access-page-variables-defined-in-the-front-matter/6398/4 "2017-04-30T16:43:48Z")

</div>

Works now! Thanks for responding.
