Jump to content

issues appending to json context an using .var directive

Recommended Posts

Im trying to do some javascript operations on a customType text input. I've got customContent.services like so:

service_1:https://link_to_service.one|service_2:https://link_to_service.two

I've writtena small js function to split this string and create an array of javascript objects like so:

[
	{
		service: service_1,
		link: https://link_to_service.two
	},
	{
		service: service_2,
		link: https://link_to_service.two
	}
]

Now I would like to take this array and render it using json-t (or any other simple method). Problem is, I can't seem to add this to the current context {@} to make it usable with {.repeated section}

I've tried stuff along the lines of:

{.var @links myJsFuncToCreateObjArray()}
{.repeated section links}
	create links for each object..
{.end}

in fact {.var @someKey func()} seem to work at all, and won't let me do {.section someKey}, I can't even get .var directive to work at all - what am I missing, and how can I append my objects to the current json context (@) to make them possible to use in my repeated sections?

 

Very thankful for any help with this.

Link to comment
  • Replies 0
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.