Added tracks layout

This commit is contained in:
Brandon Rozek 2022-05-29 12:52:49 -04:00
parent b3373844ab
commit b663bb8028
4 changed files with 65 additions and 1 deletions

6
archetypes/tracks.md Normal file
View file

@ -0,0 +1,6 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ dateFormat "2006-01-02T15:04:05Z07:00" .Date }}
draft: true
gpx: ""
---

View file

@ -1,4 +1,4 @@
{{ $url := printf "%sdata/hikes/%s" .Site.BaseURL (.Get 0) }} {{ $url := printf "%sdata/tracks/%s" .Site.BaseURL (.Get 0) }}
{{ $url_state := querify "state" (printf "{\"urls\":[\"%s\"]}" $url) }} {{ $url_state := querify "state" (printf "{\"urls\":[\"%s\"]}" $url) }}
{{ $iframe_url := printf "https://gpx.studio/?%s&embed&distance" $url_state }} {{ $iframe_url := printf "https://gpx.studio/?%s&embed&distance" $url_state }}
{{ $a_url := printf "https://gpx.studio/?%s" $url_state }} {{ $a_url := printf "https://gpx.studio/?%s" $url_state }}

20
layouts/tracks/list.html Normal file
View file

@ -0,0 +1,20 @@
{{ define "main"}}
{{ partial "header.html" . }}
<main>
{{ partial "search.html" . }}
<!-- contents -->
<div id="feedList">
{{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}}
{{ range $index, $value := .Pages.GroupByDate $listPageDateFormat }}
{{ range .Pages }}
<article class="h-entry">
<h2 class='title p-name'><a class="u-url" href="{{ .Permalink }}">{{ .Title }}</a></h2>
{{ .Scratch.Set "noDateUpdate" true }}
{{ partial "date.html" . }}
</article>
{{ end }}
{{ end }}
</div>
</main>
{{ partial "footer.html" . }}
{{ end }}

View file

@ -0,0 +1,38 @@
{{ define "main"}}
{{ .Scratch.Set "customTitleHeaderSet" true }}
{{ .Scratch.Set "customTitleHeader" "Tracks" }}
{{ .Scratch.Set "customTitleHeaderLink" "/tracks" }}
{{ partial "header.html" . }}
<main>
<article class="h-entry">
<h1 class='title p-name'>{{ .Title }}</h1>
<a style="display: none" class="u-url" href="{{ .Permalink }}"></a>
<div style="display: none;" rel="author" class="h-card p-author">
<img class="u-photo" src="{{ .Site.BaseURL }}/img/avatar.jpg"/>
<span > {{ .Site.Params.Author }}</span>
</div>
{{ .Scratch.Set "beforeDateString" "Published on "}}
{{ partial "date.html" . }}
{{ partial "reading_time.html" . }}
{{ partial "tags/page.html" . }}
<!-- content -->
<div class="e-content">
<!-- Move this to a common folder later -->
{{ $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 }}
<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 }}
</div>
</article>
{{ partial "webmentions.html" . }}
</main>
{{ partial "footer.html" . }}
{{ end }}