forked from google/docsy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix warning: '.File.UniqueID on zero object' (google#1007)
- Loading branch information
Showing
1 changed file
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |