mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-21 19:42:52 +00:00
Fix NPE if projects or blog sections doesn't exist (#148)
See https://github.com/victoriadotdev/hugo-theme-introduction/pull/143#issuecomment-481732990
This commit is contained in:
commit
76123d6853
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