# Appropriate way to build a string in scripty

**URL:** <https://zine.discourse.group/t/appropriate-way-to-build-a-string-in-scripty/16>\
**Category:** Help\
**Created:** [July 12, 2026, 10:32am UTC](https://zine.discourse.group/t/appropriate-way-to-build-a-string-in-scripty/16 "2026-07-12T10:32:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardlehane](https://yyz2.discourse-cdn.com/flex052/user_avatar/zine.discourse.group/richardlehane/32/27_2.png) [@richardlehane](https://zine.discourse.group/u/richardlehane)\
**Post date:** [July 12, 2026, 10:32am UTC](https://zine.discourse.group/t/appropriate-way-to-build-a-string-in-scripty/16/1 "2026-07-12T10:32:08Z")

</div>

I’m working on building a site in zine for a software project. I’d like to be able to code the SHTML layout so that I can automatically update links to release assets based on a provided version in a custom value in the page metadata.

E.g. the page has custom KV of “version”: “0.1.0” and from there in my template I can build links to different flavours of asset on a github release page… [github.com/v0.1.0/build-0.1.0\_win64.xip](http://github.com/v0.1.0/build-0.1.0_win64.xip), [github.com/v0.1.0/build-0.1.0\_linux64.xip](http://github.com/v0.1.0/build-0.1.0_linux64.xip)

The way I’ve got it working so far is…

```auto
<ctx ghlnk="$page.custom.getOr('yolo', 'https://github.com/snip/v')" version="$page.custom.getOr('sf', '1.1.1')" major="$ctx.version.splitN('.', 0)" minor="$ctx.version.splitN('.', 1)" patch="$ctx.version.splitN('.', 2)">
  <ctx dlnk="$ctx.ghlnk.suffix($ctx.version, '/sf_', $ctx.major, '-', $ctx.minor, '-', $ctx.patch)" win="$ctx.dlnk.suffix('\_win64.zip')" linux="$ctx.dlnk.suffix('\_linux64.zip')" mac="$ctx.dlnk.suffix('\_mac64.zip')">
  <div><a class="btn btn-large btn-primary" href="$ctx.win">

```

You can see in an outer ctx I set a starting string with the base of the github link & split the version number into major/minor/release values. Then in an inner ctx I start joining those strings using the suffix function.

I suspect I’m doing something wrong here with the way I initially create the base link (using a getOr(‘yolo’, value) that I know will fail. But is there any other way to mint a new string value for use in a later scripty expression?

---

<div class="post-metadata">

**Author:** ![kristoff](https://yyz2.discourse-cdn.com/flex052/user_avatar/zine.discourse.group/kristoff/32/6_2.png) [@kristoff](https://zine.discourse.group/u/kristoff)\
**Post date:** [July 12, 2026, 12:22pm UTC](https://zine.discourse.group/t/appropriate-way-to-build-a-string-in-scripty/16/2 "2026-07-12T12:22:02Z")

</div>

Minting values is something I’m explicitly trying to make hard in Scripty.

The reason for this is that I believe that these values should normally be placed in the page frontmatter or in the site-level custom data, instead of being hardcoded in a template, as they are effectively configuration values that should be easy to find and hard to duplicate by mistake.

In your case the base url seems a good candidate for being a site-level configuration value, so its rightful place seems in `$site.custom` (i.e. placed in your `zine.ziggy` file). Same with the version string, I believe?

I’ve noticed a bug in v0.12.0 that causes templates to fail to find values in `$site.custom`, I’ll make soon a patch release to fix the bug, in the meantime if you want to get unblocked, I recommend using your root index page as a temporary storage for site-level config values.

You can access the root index page with `$site.page('')`.  
Also `addPath` on a string might be useful to simplify some of your code.

Let me know if I missed something and expect to see v0.12.1 released soon with fixes for the issue mentioned above.

---

<div class="post-metadata">

**Author:** ![richardlehane](https://yyz2.discourse-cdn.com/flex052/user_avatar/zine.discourse.group/richardlehane/32/27_2.png) [@richardlehane](https://zine.discourse.group/u/richardlehane)\
**Post date:** [July 12, 2026, 1:37pm UTC](https://zine.discourse.group/t/appropriate-way-to-build-a-string-in-scripty/16/3 "2026-07-12T13:37:38Z")

</div>

thanks @kristoff, I hit that $site.custom bug, spent a bit of time pulling my hair, then added the custom values to the page metadata instead… glad to hear a fix is on the way!

I hear what you say about minting values in templates. That URL prefix is a constant value - it won’t change like the version number does, or not on the same timescale at least - which was why I was trying to stuff it into the template. But maybe that’s the best option.
