mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-24 17:16:31 -05:00
Refactored GPX code
This commit is contained in:
parent
defe7686a2
commit
d703530905
4 changed files with 17 additions and 31 deletions
13
layouts/partials/gpxstudio.html
Normal file
13
layouts/partials/gpxstudio.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{{ $gpxFile := .Scratch.Get "gpxFile" }}
|
||||||
|
|
||||||
|
{{ $url := printf "%sdata/tracks/%s" .Site.BaseURL $gpxFile }}
|
||||||
|
{{ $url_state := querify "state" (printf "{\"urls\":[\"%s\"]}" $url) }}
|
||||||
|
{{ $iframe_url := printf "https://gpx.studio/?%s&embed&distance" $url_state }}
|
||||||
|
{{ $a_url := printf "https://gpx.studio/?%s" $url_state }}
|
||||||
|
<iframe {{ printf "src=%q" $iframe_url | safeHTMLAttr }}
|
||||||
|
width="100%"
|
||||||
|
height="500"
|
||||||
|
frameborder="0"
|
||||||
|
allowfullscreen>
|
||||||
|
<p><a {{ printf "href=%q" $a_url | safeHTMLAttr }}></a></p>
|
||||||
|
</iframe>
|
|
@ -1,11 +1,2 @@
|
||||||
{{ $url := printf "%sdata/tracks/%s" .Site.BaseURL (.Get 0) }}
|
{{ .Scratch.Set "gpxFile" (.Get 0) }}
|
||||||
{{ $url_state := querify "state" (printf "{\"urls\":[\"%s\"]}" $url) }}
|
{{ partial "gpxstudio.html" . }}
|
||||||
{{ $iframe_url := printf "https://gpx.studio/?%s&embed&distance" $url_state }}
|
|
||||||
{{ $a_url := printf "https://gpx.studio/?%s" $url_state }}
|
|
||||||
<iframe {{ printf "src=%q" $iframe_url | safeHTMLAttr }}
|
|
||||||
width="100%"
|
|
||||||
height="500"
|
|
||||||
frameborder="0"
|
|
||||||
allowfullscreen>
|
|
||||||
<p><a {{ printf "href=%q" $a_url | safeHTMLAttr }}></a></p>
|
|
||||||
</iframe>
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{{ $url := .Get 0 }}
|
|
||||||
{{ $dataJ := getJSON $url }}
|
|
||||||
|
|
||||||
|
|
||||||
{{ range sort $dataJ "created_at" "desc" }}
|
|
||||||
{{ .Scratch.Set "toot" $dataJ }}
|
|
||||||
{{ partial "toot.html" . }}
|
|
||||||
{{ end }}
|
|
|
@ -17,18 +17,8 @@
|
||||||
{{ partial "tags/page.html" . }}
|
{{ partial "tags/page.html" . }}
|
||||||
<!-- content -->
|
<!-- content -->
|
||||||
<div class="e-content">
|
<div class="e-content">
|
||||||
<!-- Move this to a common folder later -->
|
{{ .Scratch.Set "gpxFile" .Params.gpx }}
|
||||||
{{ $url := printf "%sdata/tracks/%s" .Site.BaseURL .Params.gpx }}
|
{{ partial "gpxstudio.html" . }}
|
||||||
{{ $url_state := querify "state" (printf "{\"urls\":[\"%s\"]}" $url) }}
|
|
||||||
{{ $iframe_url := printf "https://gpx.studio/?%s&embed&distance" $url_state }}
|
|
||||||
{{ $a_url := printf "https://gpx.studio/?%s" $url_state }}
|
|
||||||
<iframe {{ printf "src=%q" $iframe_url | safeHTMLAttr }}
|
|
||||||
width="100%"
|
|
||||||
height="500"
|
|
||||||
frameborder="0"
|
|
||||||
allowfullscreen>
|
|
||||||
<p><a {{ printf "href=%q" $a_url | safeHTMLAttr }}></a></p>
|
|
||||||
</iframe>
|
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in a new issue