Options Set page type

How does the ‘page’ type work in Option Sets? I have, in the Option Set,

      "name": "cta-link",
      "label": "CTA Link",
      "type": "page",
      "value": {
        "id": 1,
        "url": "[[~1]]"

And in the Element Markup I have

<a class="btn btn-primary" href="{{ cta-link.url }}">Call to Action!</a>

All I get is href=“0”

Screen Shot 2021-02-09 at 17.06.38

It seems to work, if I don’t use a hyphen (-) in the name.

	"name": "cta_link",

Yes, of course. Looking at the example in the docs, all the names use underscores. Also, it says so in the docs: https://modxcms.github.io/fred/themer/options/settings/#setting-name-conventions

To use:

<a class="btn btn-primary" href="{{ cta_link.url }}">Call to Action!</a>

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.