Using a variable/attribute with ^setRoot()^

Is there a way to use ^setRoot()^ with a variable? I’ve tried using ^setRoot(^value(…)^)^ and ^setRoot($MyString)^ to no effect.

I would like to be able to set a template’s root based a pre-configured variable as I have multiple pages/feeds in my Tinderbox-backed blog for which URLs need to be absolute. Having a single point of control for setting the site’s root would be ideal.

As users can only black-box test, the results would suggest that ^setRoot()^'s argument is a strong literal. The action code operators have been more closely tested in this regard than export operators. The operator dates from v4.0.0, so pre-dates variables are arguments

I’m not aware of any vendor documentation of export operator argument types/scope. All we have to go on are erstwhile release notes and whatever testing might have occurred—yours may have been the first to explore this angle of types of argument accepted.

It does seem odd that an attribute stored value doesn’t work, but what is the stored value. The documentation, such as it is would suggest a value like “https://…etc.”

I don’t think ^setRoot will work with a variable. It could likely be done. I need to understand the scenario better than I do.

I devised a method to persist my site’s base/root URL in one place and use it in the relevant export templates. Thanks for sharing your thoughts @mwra and @eastgate.

I’m happy to expound on my method more if anyone else would find it helpful.

I switched my blog over to Tinderbox yesterday. So far, so good :crossed_fingers:t3:

3 Likes