mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-09 23:09:47 +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 -->
|
</section> <!-- Done with Hero -->
|
||||||
|
|
||||||
{{ with .Site.GetPage "/home" }}
|
{{ with .Site.GetPage "/home" }}
|
||||||
|
|
||||||
{{ $blog := .Site.GetPage "/blog" }}
|
|
||||||
{{ $projects := .Site.GetPage "/projects" }}
|
|
||||||
{{ $home := . }}
|
{{ $home := . }}
|
||||||
|
{{ $pages := .Resources.ByType "page" }}
|
||||||
|
|
||||||
{{ $pages := sort (.Resources.ByType "page" | append $blog | append $projects) "Params.weight" }}
|
{{ with .Site.GetPage "/blog" }}
|
||||||
{{ range $pages }}
|
{{ $pages = $pages | append . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with .Site.GetPage "/projects" }}
|
||||||
|
{{ $pages = $pages | append . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ range sort $pages "Params.weight" }}
|
||||||
{{ if ne .Name "contact.md" }}
|
{{ if ne .Name "contact.md" }}
|
||||||
{{ if eq .File.Dir "projects/" }}
|
{{ if eq .File.Dir "projects/" }}
|
||||||
<!-- Now for some cool projects -->
|
<!-- Now for some cool projects -->
|
||||||
|
|
Loading…
Reference in a new issue