Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion themes/jb/layouts/episode/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ <h6 style="font-style: italic">{{ .Date.Day }} {{ .Date.Month }} {{ .Date.Year
</center>
</div>
</div>
<div class="column is-half">
{{ partial "episode/links.html" . }}
</div>
{{ partial "episode/podverseplayer.html" . }}

{{ partial "episode/downloadlinks.html" . }}
Expand Down Expand Up @@ -114,4 +117,4 @@ <h3>Tags</h3>
</div>
</div>
</div>
{{end}}
{{end}}
32 changes: 32 additions & 0 deletions themes/jb/layouts/partials/episode/links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="level">

<a class="link level-item pr-3" target="_blank" href="{{ (.GetPage `subscribe.md`).Permalink }}" title="subscribe">
<div class="title fa fa-bell-ringing-o fa-3x"><span class="sr-only">subscribe</span></div>
</a>
<a class="link level-item pr-3" target="_blank" href="{{ (.GetPage `/membership`).Permalink }}" title="support">
<div class="title fa fa-usd fa-3x"><span class="sr-only">support</span></div>
</a>
{{with .Params.links}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, there's actually a really nice construct (.Parent) in Hugo that allows you to "traverse" up the file tree, so you can access files/parameters from parent files. So, adding that here would allow you to get access to all the links that the parent show has.

Suggested change
{{with .Params.links}}
{{with .Parent.Params.links}}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was what I was missing. :)
With that bit of knowledge, I think I can get the separate version worked out, then on to looking at DRY, which I am all for (a good SA is a Lazy SA and reuses whenever possible :) )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I now have the extra file working. Time to refactor down to one file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🥳

{{ range $key, $value := . }}
<a class="link level-item pr-3" target="_blank" href="{{$value}}" title="{{$key}}">
{{ if eq $key "email" }}
<div class="title fa fa-envelope fa-3x center"><span class="sr-only">{{$key}}</span></div>
{{ else if eq $key "shownotes" }}
<div class="title fa fa-pencil-square fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ else if eq $key "matrix" }}
<div class="title fa fa-matrix-org fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ else if eq $key "mumble" }}
<div class="title fa fa-headphones fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ else if eq $key "discord" }}
<div class="title fa fa-{{$key}} fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ else if eq $key "wiki" }}
<div class="title fa fa-book fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ else if eq $key "blog" }}
<div class="title fa fa-paragraph fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ else }}
<div class="title fa fa-{{$key}}-square fa-3x"><span class="sr-only">{{$key}}</span></div>
{{ end }}
</a>
{{ end }}
{{end}}
</div>