# Shortcode quotes vs plain string

**URL:** <https://discourse.gohugo.io/t/shortcode-quotes-vs-plain-string/20976>\
**Category:** support\
**Created:** [September 26, 2019, 10:09am UTC](https://discourse.gohugo.io/t/shortcode-quotes-vs-plain-string/20976 "2019-09-26T10:09:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajdapretnar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ajdapretnar/32/9621_2.png) [@ajdapretnar](https://discourse.gohugo.io/u/ajdapretnar)\
**Post date:** [September 26, 2019, 10:09am UTC](https://discourse.gohugo.io/t/shortcode-quotes-vs-plain-string/20976/1 "2019-09-26T10:09:34Z")

</div>

I am trying to understand the difference between the two behaviors.

**My code:**

```
{{ $func := $page.params.title}}
<div class="class" onclick={{ $page.params.title }}()>
<h2>{{ $page.params.title }}</h2>
</div>

```

**Issue:**  
`{{ $func := $page.params.title}}` returns “Title” while  
`<h2>{{ $page.params.title }}</h2>` returns Title.

Why are there quotes in the first one and none in the second, even though the call looks the same to me?

I tried also `{{ $func := $page.params.title | safeJS }}` but to no avail.

On a similar note, how to pass a function by its name to onclick? Will passing the string without quotation work?

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [September 26, 2019, 11:19am UTC](https://discourse.gohugo.io/t/shortcode-quotes-vs-plain-string/20976/2 "2019-09-26T11:19:04Z")

</div>

This will print out two identical h2 tags:

```
{{ $func := $page.params.title}}
<h2>{{ $func }}</h2>
<h2>{{ $page.params.title }}</h2>

```

This will also print out two identical onclick attributes, both with extra quotes.

```
{{ $func := $page.params.title}}
<div class="class" onclick="{{ $func }}()"></div>
<div class="class" onclick="{{ $page.params.title }}()"></div>

```

By using safeJS like this:

```
{{ $func := $page.params.title | safeJS }}
<div class="class" onclick="{{ $func }}()"></div>

```

or like this:

```
{{ $func := $page.params.title }}
<div class="class" onclick="{{ $func | safeJS }}()"></div>

```

You will get the value without extra quotes.
