From 1b4c23e670a3e1b58aa03275dc6b0aa512224968 Mon Sep 17 00:00:00 2001 From: gangjun06 Date: Sat, 15 Aug 2020 12:20:48 +0000 Subject: [PATCH] exception handling --- layouts/partials/home.html | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/layouts/partials/home.html b/layouts/partials/home.html index 26c7ee4..84b7134 100644 --- a/layouts/partials/home.html +++ b/layouts/partials/home.html @@ -1,5 +1,8 @@
-
+
- {{ $.Site.Params.maintitle }} + {{if $.Site.Params.maintitle }}{{ $.Site.Params.maintitle }}{{else}}Hello, World{{end}}
-
{{ $.Site.Params.maintext }}
+
{{if $.Site.Params.maintext}}{{ $.Site.Params.maintext }}{{else}}Edit config.toml/params{{end}}
{{ $data := .Site.Data.home }} @@ -34,9 +37,16 @@
-
{{$data.about.title}}
+
+ {{ if $data.about.title }}{{$data.about.title}}{{else}}You can put + text in data/home/about.toml/title{{end}} +
-
{{ replace $data.about.text "\n" "
" | safeHTML }}
+
+ {{ if $data.about.text}}{{ replace $data.about.text "\n" "
" | safeHTML }} + {{else}}You can put text in + data/home/about.toml/text{{end}} +
@@ -44,10 +54,12 @@
{{ partial "home_title" (dict "title" "Skills") }}
-
+ + {{if $data.skills.list}} {{ range $data.skills.list }} +
@@ -67,13 +79,18 @@

- {{end}}
+ {{end}} + {{else}} +
Skills don't exist
+ {{end}}
{{ partial "home_title" (dict "title" "Projects") }}
+ + {{if $data.skills.list}}
@@ -93,6 +110,9 @@
{{end}}
+ {{else}} +
Projects does not exist
+ {{end}}