Creating advanced variable go links with default values

Variable go links, also referred to as parameterized go links or template go links, allow you to create more customized functionalities than just the normal redirect. We’ve seen variable go links used to redirect to specific Jira tickets, instantly create meeting links, and find account data for specific users or companies within dashboards.

Variable go links are great, and they can get even more advanced. Below we describe how variable go links work with default values and optional portions.

Basic Example

Use the {*} pattern to define where the variable should live in the URL.

GolinkURL
Setupgo/searchhttps://www.google.com/?q={*}&hl=EN
Usagego/search/searchtermhttps://www.google.com/?q=searchterm&hl=EN
Usagego/searchhttps://www.google.com/?q=&hl=EN

Variable links are useful, but as you can see in the last example, using the go link without the variable usually doesn’t resolve to a URL that makes sense. This is where the curly braces come in.

Optional portions

Option portions of the URL can be included and removed with the curly brace syntax.

Use the {{ and }} patterns to define which part of the URL should be optional if no variable is used.

GolinkURL
Setupgo/searchhttps://www.google.com/{{?q={*}&hl=EN}}
Usagego/search/searchtermhttps://www.google.com/?q=searchterm&hl=EN
Usagego/searchhttps://www.google.com

Default Values

Sometimes you still want to use the optional portions but instead of removing portions of the URL, you want to provide a default value for what should be in place of the option portion. This is where the “pipe” characters comes into use.

Use the | character inside of the {{ and }} patterns to define a default value that will replace everything inside of the {{ and }} patterns

Go linkURL
Setupgo/searchhttps://www.google.com/{{?q={*} | ?q=default}}
Usagego/search/searchtermhttps://www.google.com/?q=searchterm
Usagego/searchhttps://www.google.com/?q=default

This is the same implementation as the example above, just written differently

Go linkURL
Setupgo/searchhttps://www.google.com/?q={{{*}|default}}
Usagego/search/searchtermhttps://www.google.com/?q=searchterm
Usagego/searchhttps://www.google.com/?q=default

The same example again, but written different

Go linkURL
Setupgo/searchhttps://{{www.google.com/?q={*}|www.google.com/?q=default}}
Usagego/search/searchtermhttps://www.google.com/?q=searchterm
Usagego/searchhttps://www.google.com/?q=default

Variable Top Domains

With the previous example, you can see how you can change the underlying URL depending on if a variable is used or not. In this example, let’s say you wanted to search bing if there was a variable, and if there is not a variable, just open up Google. You can do that like this.

Go linkURL
Setupgo/searchhttps://{{www.bing.com/?q={*}|www.google.com}}
Usagego/search/searchtermhttps://www.bing.com/?q=searchterm
Usagego/searchhttps://www.google.com

This previous example doesn’t make sense in a real-world example, but this becomes useful for pages that have a search.

A Real Example with Google Drive

Here is a real example that will use go/drive to go to a specific Google Drive folder, and if there is a variable, it will search that Google Drive folder with the term.

  1. Go to https://drive.google.com/
  2. Find a Folder you want to choose for Google Drive
  3. Write down the URL: https://drive.google.com/drive/folders/16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
  4. Next, type in a search term into the Search Bar like “searchterm”, but don’t click Search yet.
  5. Click on the filter button in the Google Drive search bar on the right.
  6. Choose a “Location” to the same Google Drive Folder
  7. Click Select.
  8. Now click “Search”
  9. You should see a URL like this: https://drive.google.com/drive/search?q=searchterm%20parent:16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
  10. Now you have 2 URLs. Combine them to look like this:
  11. https://drive.google.com/drive/{{search?q={*}%20parent:|folders/}}16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
Go linkURL
Setupgo/drivehttps://drive.google.com/drive/{{search?q={*}%20parent:|folders/}}16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
Usagego/drive/searchtermhttps://drive.google.com/drive/search?q=searchterm%20parent:16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
Usagego/drivehttps://drive.google.com/drive/folders/16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh

Now when you type in go/drive you will end up at the specific folder, but if you want to search that folder you simply type in go/drive/searchterm.

Need more help?

Technical support

Send us your technical inquiries

Contact us →
Contact sales

Demo or answer sales questions

Contact sales →
Chat with us

Get quicker responses with chat

Chat now →
Blog

GoLinks® and productivity articles

View blog →