Skip to content

Commit

Permalink
Add support for guest_group to guest pages
Browse files Browse the repository at this point in the history
Fixes #159
  • Loading branch information
mattstratton committed Apr 23, 2020
1 parent cc82a4a commit a8eb72a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion exampleSite/content/episode/april.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ date = "2016-04-25T04:09:45-05:00"
episode = "7"
episode_image = "img/episode/april.jpg"
explicit = "no"
guests = ["jdoe", "jsmith"]
guests = ["jdoe", "jsmith", "ajohnston2"]
hosts = ["mstratton","bkromhout"]
images = ["http://www.google.comimg/episode/default-social.jpg"]
news_keywords = []
Expand Down
42 changes: 24 additions & 18 deletions layouts/guest/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,33 @@ <h1>{{ title .Title }}</h1>
<div class = "row">
<div class="col">
<h3>Episodes Featuring {{ .Title }}</h3>
<div class="list-group guest_episode_list">
{{ $.Scratch.Set "guest-name" .File.BaseFileName }}
{{ range $page := where $.Site.Pages "Type" "episode" }}
{{ range $page.Params.guests }}
{{ if eq . ($.Scratch.Get "guest-name") }}
<a href = "{{$page.Permalink}}" class = "guest_page_episode_link list-group-item list-group-item-action">{{$page.Title}}</a>
{{ end }}
{{ end }}
{{ end }}

{{- with .Params.guest_group -}}
{{- range where $.Site.Pages "Params.guest_group" . -}}
{{- $.Scratch.Add "guest-names" (slice .File.BaseFileName) -}}
{{- end -}}
{{- else -}}

{{- with .Params.Aka -}}
{{ range $name := . }}
{{- $.Scratch.Set "guest-name" $name -}}
{{- range $page := where $.Site.Pages "Type" "episode" -}}
{{- range $page.Params.guests -}}
{{- if eq . ($.Scratch.Get "guest-name") -}}
<a href = "{{$page.Permalink}}" class = "guest_page_episode_link list-group-item list-group-item-action">{{$page.Title}}</a>
{{- end -}}
{{- end -}}
{{- end -}}
{{- range $names := . -}}
{{- $.Scratch.Add "guest-names" (slice $names) -}}
{{- end -}}
{{- else -}}
{{ $.Scratch.Set "guest-names" (slice .File.BaseFileName) }}
{{- end -}}
{{- end -}}

<div class="list-group guest_episode_list">
{{ range $name := ($.Scratch.Get "guest-names") }}
{{- $.Scratch.Set "guest-name" $name -}}
{{- range $page := where $.Site.Pages "Type" "episode" -}}
{{- range $page.Params.guests -}}
{{- if eq . ($.Scratch.Get "guest-name") -}}
<a href = "{{$page.Permalink}}" class = "guest_page_episode_link list-group-item list-group-item-action">{{$page.Title}}</a>
{{- end -}}<!-- if eq guest name-->
{{- end -}}<!-- range params guests -->
{{- end -}}<!--range episodes -->
{{- end -}}<!-- range -->
</div>
</div>
</div>
Expand Down

0 comments on commit a8eb72a

Please sign in to comment.