Fix NPE if projects or blog sections doesn't exist

This commit is contained in:
Hanzei 2019-04-10 18:22:12 +02:00
parent 5712e49125
commit 5d4dc2005c
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0

View file

@ -42,13 +42,18 @@
</section> <!-- Done with Hero -->
{{ with .Site.GetPage "/home" }}
{{ $blog := .Site.GetPage "/blog" }}
{{ $projects := .Site.GetPage "/projects" }}
{{ $home := . }}
{{ $pages := .Resources.ByType "page" }}
{{ $pages := sort (.Resources.ByType "page" | append $blog | append $projects) "Params.weight" }}
{{ range $pages }}
{{ with .Site.GetPage "/blog" }}
{{ $pages = $pages | append . }}
{{ end }}
{{ with .Site.GetPage "/projects" }}
{{ $pages = $pages | append . }}
{{ end }}
{{ range sort $pages "Params.weight" }}
{{ if ne .Name "contact.md" }}
{{ if eq .File.Dir "projects/" }}
<!-- Now for some cool projects -->