Browse Source

Change the layout of the podcast page

master
dtluna 6 months ago
parent
commit
cc083857ee

+ 20
- 13
layouts/_default/single.html View File

@@ -1,29 +1,36 @@
{{- define "main" -}}
<div class="row">
<div class="col-sm">
<div class="col">
<h1>{{- .Title -}}</h1>
<p>{{- partial "post-meta.html" . -}}</p>
<p>
{{- partial "tags.html" . -}}
</p>
</div>
</div>
<div class="row">
<div class="col">
{{- partial "audio.html" . -}}
<div class="row">
<div class="col">
{{- .Content -}}
</div>
</div>
</div>
</div>

<div class="row mt-4">
<div class="col">
{{- .Content -}}
</div>
</div>
<div class="row mb-4 border-bottom">
<div class="col">
{{- partial "tags.html" . -}}
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="col">
{{- partial "downloads.html" . -}}
</div>
<div class="col">
{{- partial "related-content.html" . -}}
</div>
</div>

{{- if .Param "enable_commento" -}}
<div class="row">
<div class="col-sm">
<div class="col">
{{- partial "commento.html" . -}}
</div>
</div>

+ 18
- 32
layouts/partials/audio.html View File

@@ -1,36 +1,22 @@
<div class="row">
<div class="col">
{{ $haslink := false }}
{{ range $.Site.Params.audio_links }}
{{ if $.Param .param_name }}
{{ if .type }}
{{ $haslink = true }}
{{ end }}
{{ end }}
{{ $haslink := false }}
{{ range $.Site.Params.audio_links }}
{{ if $.Param .param_name }}
{{ if .type }}
{{ $haslink = true }}
{{ end }}
{{ end }}
{{ end }}

{{ if $haslink }}
<h4><i class="fas fa-podcast"></i> Listen to audio:</h4>
<audio class="w-100" controls>
{{ range $.Site.Params.audio_links }}
{{ $audioFile := $.Param .param_name }}
{{ if $audioFile }}
{{ if .type }}
<source src="{{ $audioFile }}" type="{{ .type }}">
{{ end }}
{{ end }}
{{ if $haslink }}
<h4><i class="fas fa-podcast"></i> Listen to audio:</h4>
<audio class="w-100" controls>
{{ range $.Site.Params.audio_links }}
{{ $audioFile := $.Param .param_name }}
{{ if $audioFile }}
{{ if .type }}
<source src="{{ $audioFile }}" type="{{ .type }}">
{{ end }}
</audio>
{{ end }}

<h4><i class="fas fa-download"></i> Downloads:</h4>
<p>
{{ range $.Site.Params.audio_links }}
{{ $audioFile := $.Param .param_name }}
{{ if $audioFile }}
<a href={{ $audioFile }} download><i class="fas fa-download"></i> {{ .label }}</a>
{{ end }}
{{ end }}
</p>
</div>
</div>
{{ end }}
</audio>
{{ end }}

+ 11
- 0
layouts/partials/downloads.html View File

@@ -0,0 +1,11 @@
<h4><i class="fas fa-download"></i> Downloads:</h4>
<ul>
{{ range $.Site.Params.audio_links }}
{{ $audioFile := $.Param .param_name }}
{{ if $audioFile }}
<li>
<a href={{ $audioFile }} download>{{ .label }}</a>
</li>
{{ end }}
{{ end }}
</ul>

+ 7
- 5
layouts/partials/tags.html View File

@@ -1,10 +1,12 @@
<h4><i class="fas fa-tags"></i> Tags:</h4>
<p>
{{ $taxo := "tags" }} <!-- Use the plural form here -->
{{- range .Param $taxo -}}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }}
<a href="{{ .Permalink }}"><i class="fas fa-tag"></i> {{ $name }}</a>
{{ end }}
{{ $elems := .Param $taxo }}
{{ $last_index := sub (len $elems) 1 }}
{{- range $elem_index, $name := $elems -}}
{{- with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }}
<a href="{{ .Permalink }}">{{ $name }}</a>
{{- if ne $elem_index $last_index }}, {{- end }}
{{- end }}
{{- end -}}
</p>

Loading…
Cancel
Save