load_content

Description

Takes an array of URLs and returns the output of content metadata as recorded in the Content Library.

  • Takes a maximum of ten (10) URLs in the array.
  • Output includes tags, title, description, image, price, etc.
{load_content(["http://example.com/item1", "http://example.com/item2"])}

Examples

Use load_content() in conjunction with profile variables that store an array of URLs for saved product or articles.

{my_items = load_content(profile.vars.saved_items)}

This returns a JSON object:


[{"id": "1234", "title" : "Item 1", "url" : "http://example.com/item1", "tags": ["tag1", "tag2", "tag3"]}, 
{"id": "4567", "title" : "Item 2", "url" : "http://example.com/item2", "tags": ["tag3", "tag4", "tag5"]}]

Create a foreach loop to return saved items.

{my_items = load_content(profile.vars.saved_items)}

{if length(my_items) > 0}
   <h3>Don't forget to check out:</h3>
	{foreach my_items as item}
        <p>{item.title}</p<
	{/foreach}
{/if}

Which would output as:

Don’t forget to check out:

Item 1

Item 2

Top