Dinosaur Books
Top Ten of 2022
The following has evaluated to null or missing:
==> tokensJson['tokens'][username] [in template "384618#384647#413897" at line 21, column 33]
----
Tip: It's the final [] step that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${tokensJson["tokens"][username]} [in template "384618#384647#413897" at line 21, column 31]
----
1<#assign orientationDefault = "horizontal"/>
2<#if orientation?? && orientation.getData() !="">
3 <#assign orientationDefault = orientation.getData() />
4</#if>
5
6<#-- getting the data from the CDN JSON file -->
7<#function readJSON apiUrl>
8 <#assign response = httpUtilUnsafe.URLtoString(apiUrl) />
9 <#assign result = jsonFactoryUtil.looseDeserialize(response) />
10 <#return result />
11</#function>
12<#assign tokensJson = readJSON("https://cdn-s3.axiell.com/arena/instagram/arena-instagram-tokens.json") />
13<#assign username = userName.getData() />
14
15<div id="instagram-feed" class="instagram-feed instagram-feed--items-${items.getData()?substring(1)} instagram-feed--captions-${captions.getData()} instagram-feed--display-${orientationDefault}"></div>
16<script src="https://cdn.jsdelivr.net/gh/stevenschobert/instafeed.js@2.0.0rc1/src/instafeed.min.js"></script>
17<script>
18 var userFeed = new Instafeed({
19 get: 'user',
20 target: "instagram-feed",
21 accessToken: "${tokensJson['tokens'][username]}",
22 limit: ${items.getData()?substring(1)},
23 template: '<a target="_blank" href="{{link}}"><img src="{{image}}" alt="{{type}}'+' from '+'{{username}}'+' Instagram"/><span>"{{caption}}"</span></a>'
24 });
25 userFeed.run();
26</script>
