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.
Golink | URL | |
Setup | go/search | https://www.google.com/?q={*} &hl=EN |
Usage | go/search/searchterm | https://www.google.com/?q=searchterm &hl=EN |
Usage | go/search | https://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.
Golink | URL | |
Setup | go/search | https://www.google.com/{{ ?q={*} &hl=EN}} |
Usage | go/search/searchterm | https://www.google.com/?q=searchterm &hl=EN |
Usage | go/search | https://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 link | URL | |
Setup | go/search | https://www.google.com/{{ ?q={*} | ?q=default}} |
Usage | go/search/searchterm | https://www.google.com/?q=searchterm |
Usage | go/search | https://www.google.com/?q=default |
This is the same implementation as the example above, just written differently
Go link | URL | |
Setup | go/search | https://www.google.com/?q={{{*}| default}} |
Usage | go/search/searchterm | https://www.google.com/?q=searchterm |
Usage | go/search | https://www.google.com/?q=default |
The same example again, but written different
Go link | URL | |
Setup | go/search | https://{{ www.google.com/?q={*}| www.google.com/?q=default}} |
Usage | go/search/searchterm | https://www.google.com/?q=searchterm |
Usage | go/search | https://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 link | URL | |
Setup | go/search | https://{{ www.bing.com/?q={*}| www.google.com}} |
Usage | go/search/searchterm | https://www.bing.com/?q=searchterm |
Usage | go/search | https://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.
- Go to https://drive.google.com/
- Find a Folder you want to choose for Google Drive
- Write down the URL: https://drive.google.com/drive/folders/16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
- Next, type in a search term into the Search Bar like “searchterm”, but don’t click Search yet.
- Click on the filter button in the Google Drive search bar on the right.
- Choose a “Location” to the same Google Drive Folder
- Click Select.
- Now click “Search”
- You should see a URL like this: https://drive.google.com/drive/search?q=searchterm%20parent:16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
- Now you have 2 URLs. Combine them to look like this:
- https://drive.google.com/drive/
{{
search?q={*}
%20parent:|
folders/}}
16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh
Go link | URL | |
Setup | go/drive | https://drive.google.com/drive/{{ search?q={*} %20parent:| folders/}} 16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh |
Usage | go/drive/searchterm | https://drive.google.com/drive/search?q=searchterm %20parent:16mJwzXAnHTxxxLjwzLIJmKgbbuBkGXGh |
Usage | go/drive | https://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.