# Help with PageOutput Error for .Featured\_Image

**URL:** <https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716>\
**Category:** support\
**Created:** [October 15, 2018, 1:32pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716 "2018-10-15T13:32:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 1:32pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/1 "2018-10-15T13:32:55Z")

</div>

Hello Hugo friends!

I’m having a BLAST with Hugo! I’ve got an error (see below) I’m hoping someone can help me figure out please?

in my config.toml I’ve placed the following:

```auto
[params]

featured_image = ''"

```

in my partial head I’ve placed the following code:

(at line 9)

```auto
    <meta name="twitter:image" content="{{if .IsHome}}{{ $.Site.Params.featured_image }}{{else}}{{.Featured_Image}}{{end}}">

```

on the page legal-services/bankruptcy.md I’ve placed the following front matter code:

```auto
title: "Bankruptcy Lawyer - Legal Services | Squiller & Hamilton, LLP"
date: 2018-09-12T20:14:18-04:00
draft: false
Description: "Need a bankruptcy lawyer? Squiller & Hamilton, LLP, located in Auburn, Indiana, provides exceptional legal services for those in need of a bankruptcy attorney."
Featured_Image: "https://firebasestorage.googleapis.com/v0/b/appsradix.appspot.com/o/images%2Fbankruptcy-lawyer-1280x555.jpg?alt=media&token=d12b777f-42df-4bde-8d67-1dc41979ea41 "
---

```

When I run hugo I get the following error:

```auto
hugo Building sites . ERROR 2018/10/15 09:21:55 Error while rendering "section" in "legal-services\\": template: _default\list.html:3:8: executing "_default\\list.ht ml" at <partial "head.html" ...>: error calling partial: template: partials/head .html:9:92: executing "partials/head.html" at <.Featured_Image>: can't evaluate field Featured_Image in type *hugolib.PageOutput

```

Any ideas as to what this rookie is doing wrong?

Thank you so much in advance for any help you could give me!

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [October 15, 2018, 1:53pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/4 "2018-10-15T13:53:24Z")

</div>

> [@Ken\_Button](#):
>
> can’t evaluate field Featured\_Image in type \*hugolib.PageOutput

> [@Ken\_Button](#):
>
> {{.Featured\_Image}}

You are trying to access a custom front matter variable: [Front matter | Hugo](https://gohugo.io/content-management/front-matter#user-defined) so you need to access it as `.Params.featured_image` .

Note the casing: [Page variables | Hugo](https://gohugo.io/variables/page/#page-level-params)

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:02pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/5 "2018-10-15T14:02:36Z")

</div>

YOU ARE AWESOME!!! Thank you so very much! Now I found I have one small issue. The URL went into the build well but I need to cleanse / make it text I think as it took the “&” symbol in the URL and made it “&amp”

New code:

```
{{if .IsHome}}{{ $.Site.Params.featured_image }}{{else}}{{.Params.featured_image}}{{end}}">

```

I need to put an absolute URL in as I’m using a Firebase full URL.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [October 15, 2018, 2:32pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/6 "2018-10-15T14:32:23Z")

</div>

Looking through the functions I see `safeURL`. Have never tried it personally but wonder if this would work

```auto
{{ if .IsHome }}
  {{ $.Site.Params.featured_image | safeURL }}
{{ else }}
  {{ .Params.featured_image | safeURL }}
{{ end }}

```

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:35pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/7 "2018-10-15T14:35:22Z")

</div>

Tried it just now and that didn’t work but it may with another function! I’ll look into those now.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [October 15, 2018, 2:38pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/8 "2018-10-15T14:38:03Z")

</div>

Edited the snippet to pipe to `htmlUnescape` first then to `safeURL`

{{ if .IsHome }}  
{{ $.Site.Params.featured\_image | htmlUnescape | safeURL }}  
{{ else }}  
{{ .Params.featured\_image | htmlUnescape | safeURL }}  
{{ end }}

> **[htmlUnescape](https://gohugo.io/functions/htmlunescape/)**
>
> Returns the given string with HTML escape codes un-escaped.

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:39pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/9 "2018-10-15T14:39:23Z")

</div>

> [@zwbetz](#):
>
> htmlUnescape | safeURL

Just saw the htmlUnescape function as you were typing this! I tried it already without the safeURL function and that didn’t work - I’ll now try it with the safeURL as well.

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:42pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/10 "2018-10-15T14:42:06Z")

</div>

Still doesn’t work ☹

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:45pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/11 "2018-10-15T14:45:22Z")

</div>

SOLVED!

pipe in urlize !!!

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:46pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/12 "2018-10-15T14:46:41Z")

</div>

Pipe in function safeHTML does it !

> [@zwbetz](#):
>
> {{ if .IsHome }}  
> {{ $.Site.Params.featured\_image | safeHTML }}  
> {{ else }}  
> {{ .Params.featured\_image | safeHTML }}  
> {{ end }}

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [October 15, 2018, 2:47pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/13 "2018-10-15T14:47:43Z")

</div>

Nice. Good to know for the future if/when I come across this

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 2:54pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/14 "2018-10-15T14:54:48Z")

</div>

I spoke too soon lol…

This took the dang & out lol and other parts of the URL like the ? ugg…

---

<div class="post-metadata">

**Author:** ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)\
**Post date:** [October 15, 2018, 3:07pm UTC](https://discourse.gohugo.io/t/help-with-pageoutput-error-for-featured-image/14716/15 "2018-10-15T15:07:11Z")

</div>

OK… finally got it. Just need to pipe safeHTML ! That preserves the entire link properly!
