URLLoad and Repeating Links

Hi all,

I am looking for a way to utilize {urlload} and to be able to wrap the link and title of the content. So far, I am able to extractregexall and then split all Titles and URLS, however, I am wondering if there is a way to wrap each Title with the URL using {link: {=URL}}{=Title}{endlink}. Is this possible using the {Repeat} function? If so, any suggestions?

Please let me know if the clarity is needed. Thanks!

Example so far:

{formtext: name=KCSearch}
{urlload: https://abc123.com/hc/en-us/search?utf8=&query={=KCSearch}; done=(res) -> ["URL"=extractregexall(res, "<a href="/hc/en-us/search/click?data=([^"]+)"), "Title"=extractregexall(res, "results-list-item-link">([^<]+)")]}

Hi Josh, is this similar to what you're looking for? I used the repeat command with list comprehension (docs):

{URLs=["blaze.today", "community.blaze.today", "dashboard.blaze.today"]}
{Titles=["Homepage", "Forum", "Dashboard"]}
{repeat: for (url, i) in URLs; trim=yes}
{title=Titles[i]}
Link: {=url} with title {=title}
{endrepeat}

Hi @Gaurang_Tandon ,

Thanks for your response! This isn't quite what I am looking for.

I am looking to utilize the {urlload} command to only load the content Titles + URLs for a list of references. Currently, I can load each individually as separate items, however, I am trying to hyperlink the title with the corresponding URL.

For example, I am using the {formmenu: name=search} command to dynamically return results from a site directory, which I can do for each item but at the moment I've basically created two separate lists.

What I have done:
Search: {formmenu: name=search; default=How to Code}
Content Title: "How to Code?"
Content URL: "https://example.com/how-to-code"

What I want to do for all articles on a page not just one:
Search: {formmenu: name=search; default=How to Code}
Content Title+URL: "How to Code?"

I was wondering if somehow utilizing the {Repeat} command could solve for the repetition (e.g. wrap Title A with URL A, Title B with URL B, etc.) while including the {link} command as well.

Does that make sense?

Hi Josh, I converted my earlier snippet to now use the dynamic link command. I hope it's useful now:

{URLs=["https://blaze.today", "https://community.blaze.today", "https://dashboard.blaze.today"]; trim=yes}
{Titles=["Homepage", "Forum", "Dashboard"]}
{repeat: for (url, i) in URLs; trim=yes}
{title=Titles[i]; trim=yes}
{link: {=url}}{=title}{endlink}
{endrepeat}

2 Likes