mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-12-22 14:42:54 +00:00
Fix NPE if projects or blog sections doesn't exist
This commit is contained in:
parent
5712e49125
commit
5d4dc2005c
1 changed files with 10 additions and 5 deletions
|
@ -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 -->
|
||||
|
|
Loading…
Reference in a new issue