From d7035309052e62bea774698be06e136b82263dc8 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Thu, 2 Jun 2022 20:32:21 -0400 Subject: [PATCH] Refactored GPX code --- layouts/partials/gpxstudio.html | 13 +++++++++++++ layouts/shortcodes/displayGPX.html | 13 ++----------- layouts/shortcodes/displayToots.html | 8 -------- layouts/tracks/single.html | 14 ++------------ 4 files changed, 17 insertions(+), 31 deletions(-) create mode 100644 layouts/partials/gpxstudio.html delete mode 100644 layouts/shortcodes/displayToots.html diff --git a/layouts/partials/gpxstudio.html b/layouts/partials/gpxstudio.html new file mode 100644 index 0000000..df05727 --- /dev/null +++ b/layouts/partials/gpxstudio.html @@ -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 }} + \ No newline at end of file diff --git a/layouts/shortcodes/displayGPX.html b/layouts/shortcodes/displayGPX.html index 7ed4a42..dff024a 100644 --- a/layouts/shortcodes/displayGPX.html +++ b/layouts/shortcodes/displayGPX.html @@ -1,11 +1,2 @@ -{{ $url := printf "%sdata/tracks/%s" .Site.BaseURL (.Get 0) }} -{{ $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 }} - \ No newline at end of file +{{ .Scratch.Set "gpxFile" (.Get 0) }} +{{ partial "gpxstudio.html" . }} diff --git a/layouts/shortcodes/displayToots.html b/layouts/shortcodes/displayToots.html deleted file mode 100644 index 2853d7d..0000000 --- a/layouts/shortcodes/displayToots.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ $url := .Get 0 }} -{{ $dataJ := getJSON $url }} - - -{{ range sort $dataJ "created_at" "desc" }} - {{ .Scratch.Set "toot" $dataJ }} - {{ partial "toot.html" . }} -{{ end }} diff --git a/layouts/tracks/single.html b/layouts/tracks/single.html index 4901ef8..c8618a4 100644 --- a/layouts/tracks/single.html +++ b/layouts/tracks/single.html @@ -17,18 +17,8 @@ {{ partial "tags/page.html" . }}
- - {{ $url := printf "%sdata/tracks/%s" .Site.BaseURL .Params.gpx }} - {{ $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 }} - + {{ .Scratch.Set "gpxFile" .Params.gpx }} + {{ partial "gpxstudio.html" . }} {{ .Content }}