Skip to content

Commit

Permalink
get holiday json in partial, call with partialcached
Browse files Browse the repository at this point in the history
  • Loading branch information
RickCogley committed Oct 11, 2021
1 parent fcf7685 commit 1268d40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 2 additions & 5 deletions layouts/_default/single.html
Expand Up @@ -8,11 +8,8 @@
<h1 class="ss09 one">{{ .Title }}</h1>
<h2 class="four">{{ .Date.Format "Monday, 2 Jan, 2006" }}</h2>
{{ $dt := .Date.Format "02 Jan 2006" }}
{{ $token := getenv "PRODBTOKEN15331" }}
{{ $bearertoken := printf "Bearer %s" $token }}
{{ $holidaydata := getJSON "https://pro.dbflex.net/secure/api/v2/15331/Work%20Holiday/API%20Holidays/select.json" (dict "Authorization" $bearertoken) }}

{{ range where $holidaydata ".Date with Month Name" $dt }}
{{ $holdata := partialCached "holidays-json.html" . }}
{{ range where $holdata ".Date with Month Name" $dt }}
{{ with (index . "Name") }}
<span class="three bg-near-white br3 pa1">🗓 "<strong><i>{{ . }}</i></strong>" in Japan</span>
{{ end }}
Expand Down
7 changes: 2 additions & 5 deletions layouts/index.html
Expand Up @@ -15,11 +15,8 @@ <h1 class="one">Welcome</h1>
<div class="pr3-ns mb4 mb0-ns w-100 w-20-ns">
<h3 class="gray f4">{{ .Key }}</h3>
{{ $dt := .Key }}
{{ $token := getenv "PRODBTOKEN15331" }}
{{ $bearertoken := printf "Bearer %s" $token }}
{{ $holidaydata := getJSON "https://pro.dbflex.net/secure/api/v2/15331/Work%20Holiday/API%20Holidays/select.json" (dict "Authorization" $bearertoken) }}

{{ range where $holidaydata ".Date with Month Name" $dt }}
{{ $holdata := partialCached "holidays-json.html" . }}
{{ range where $holdata ".Date with Month Name" $dt }}
{{ with (index . "Name") }}
<p class="three bg-near-white br3">🗓 "<strong><i>{{ . }}</i></strong>" in Japan</p>
{{ end }}
Expand Down
5 changes: 5 additions & 0 deletions layouts/partials/holidays-json.html
@@ -0,0 +1,5 @@
{{ $token := getenv "PRODBTOKEN15331" }}
{{ $bearertoken := printf "Bearer %s" $token }}
{{ $holdata := getJSON "https://pro.dbflex.net/secure/api/v2/15331/Work%20Holiday/API%20Holidays/select.json" (dict "Authorization" $bearertoken) }}

{{ return $holdata }}

0 comments on commit 1268d40

Please sign in to comment.