Skip to content

Commit

Permalink
Fix warning: '.File.UniqueID on zero object' (google#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
deining committed Jul 29, 2023
1 parent b23dd41 commit 5c9638c
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions layouts/partials/section-index.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<div class="section-index">
{{ $parent := .Page }}
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
{{ $parent := .Page -}}
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}}
{{ $pages = (where $pages "Type" "!=" "search") }}
{{ $pages = (where $pages ".Params.hide_summary" "!=" true) }}
{{ $pages = (where $pages ".Parent" "!=" nil) }}
{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }}
{{ if or $parent.Params.no_list (eq (len $pages) 0) }}
{{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}}
{{ $pages = (where $pages ".Parent" "!=" nil) -}}
{{ with .Parent.File -}}
{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}}
{{ end -}}
{{ if or $parent.Params.no_list (eq (len $pages) 0) -}}
{{/* If no_list is true or we don't have subpages we don't show a list of subpages */}}
{{ else if $parent.Params.simple_list }}
{{ else if $parent.Params.simple_list -}}
{{/* If simple_list is true we show a bulleted list of subpages */}}
<ul>
{{ range $pages }}
{{ range $pages -}}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
<li><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a></li>
{{ end }}
{{ end -}}
</ul>
{{ else }}
{{ else -}}
{{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
<hr class="panel-line">
{{ range $pages }}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
{{ range $pages -}}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) -}}
<div class="entry">
<h5>
<a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a>
</h5>
<p>{{ .Description | markdownify }}</p>
<p>{{ .Description | markdownify -}}</p>
</div>
{{ end }}
{{ end }}
{{ end -}}
{{ end -}}
</div>

0 comments on commit 5c9638c

Please sign in to comment.