I made a custom button short code.
Here’s the code in the button.html short code file:
<button href="{{ .Get "x" | safeURL }}">{{.Get "text" }}</button>
Here’s the code in the Markdown body:
{{< button x="{{site.admin_url}}/settings/{{addon.slug}}" text="See plans and usage">}}
And this is what gets complied after I run the Hugo engine:
<button href="%7b%7bsite.admin_url%7d%7d/settings/%7b%7baddon.slug%7d%7d">See plans and usage</button>
My goal is to keep the double curly braces from being consumed by Hugo engine b/c my next step is to use Liquid engine to process the data through those curly braces.
Hope this explains better of the problem I’d like to solve. Thanks a lot!
It’s not clear what you are doing there… can you paste the exact code from your template file within:
```
```
Thanks. Just updated my question. Let me know if you have any questions!
Now that makes more sense as to why it’s not working
… you cannot nest the {{ .. }}
.
It’s not clear what site.admin_url
and addon.slug
are… may be you want to pass them as two parameters “x” and “y” to the shortcode? Don’t pass the curly braces through the shortcode.
Thanks @kaushalmodi!
I’m curious cuz in my other short code, the Gmail Action short code. It actually works.
But the short code was written in JSON.
Code example:
In the short code file:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "{{ .Get `target` }}",
"url": "{{ .Get `target` }}",
"name": "{{ .Get `label` }}"
}
}
</script>
In markdown body:
{{< gmailaction label="See plans and usage" target="{{site.admin_url}}/settings/{{addon.slug}}" >}}
After running through Hugo:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "{{site.admin_url}}/settings/{{addon.slug}}",
"url": "{{site.admin_url}}/settings/{{addon.slug}}",
"name": "See plans and usage"
}
}
</script>
Again, can you please put the whole thing exactly as it is in your template in:
```
```
Stuff like this does not make sense:

Finally, just share a repo to your site; it will be much easier helping using that.