exception handling

This commit is contained in:
gangjun06 2020-08-15 12:20:48 +00:00
parent c60aad7ad5
commit 1b4c23e670
1 changed files with 29 additions and 9 deletions

View File

@ -1,5 +1,8 @@
<div> <div>
<div id="mainBG" style="background-image: url('{{ $.Site.Params.mainbg }}');"> <div
id="mainBG"
style="background-image: url('{{ if $.Site.Params.mainbg }}{{ $.Site.Params.mainbg }}{{ else }}https://picsum.photos/1920/1080{{ end }}');"
>
<div <div
class="wave wave1" class="wave wave1"
style="background-image: url('{{ .Site.BaseURL }}/img/wave.png');" style="background-image: url('{{ .Site.BaseURL }}/img/wave.png');"
@ -18,9 +21,9 @@
></div> ></div>
<div class="centerAll"> <div class="centerAll">
<div class="title text-6xl font-bold text-center"> <div class="title text-6xl font-bold text-center">
{{ $.Site.Params.maintitle }} {{if $.Site.Params.maintitle }}{{ $.Site.Params.maintitle }}{{else}}Hello, World{{end}}
</div> </div>
<div class="text text-xl text-center">{{ $.Site.Params.maintext }}</div> <div class="text text-xl text-center">{{if $.Site.Params.maintext}}{{ $.Site.Params.maintext }}{{else}}Edit config.toml/params{{end}}</div>
</div> </div>
</div> </div>
{{ $data := .Site.Data.home }} {{ $data := .Site.Data.home }}
@ -34,9 +37,16 @@
</div> </div>
</div> </div>
<div class="mt-4 md:mt-0 md:ml-4"> <div class="mt-4 md:mt-0 md:ml-4">
<div class="text-2xl font-bold">{{$data.about.title}}</div> <div class="text-2xl font-bold">
{{ if $data.about.title }}{{$data.about.title}}{{else}}You can put
text in data/home/about.toml/title{{end}}
</div>
<div class="text-lg mt-3"> <div class="text-lg mt-3">
<div>{{ replace $data.about.text "\n" "<br />" | safeHTML }}</div> <div>
{{ if $data.about.text}}{{ replace $data.about.text "\n" "<br />" | safeHTML }}
{{else}}You can put text in
data/home/about.toml/text{{end}}
</div>
</div> </div>
</div> </div>
</section> </section>
@ -44,10 +54,12 @@
<div class="md:flex justify-center"> <div class="md:flex justify-center">
{{ partial "home_title" (dict "title" "Skills") }} {{ partial "home_title" (dict "title" "Skills") }}
</div> </div>
{{if $data.skills.list}}
{{ range $data.skills.list }}
<div <div
class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"
> >
{{ range $data.skills.list }}
<div class="w-full rounded overflow-hidden shadow-lg"> <div class="w-full rounded overflow-hidden shadow-lg">
<div class=""> <div class="">
<div class="font-bold text-xl mb-2 py-2 px-6 bg-gray-500"> <div class="font-bold text-xl mb-2 py-2 px-6 bg-gray-500">
@ -67,13 +79,18 @@
</p> </p>
</div> </div>
</div> </div>
{{end}}
</div> </div>
{{end}}
{{else}}
<div class="mt-4 text-xl text-center">Skills don't exist</div>
{{end}}
</section> </section>
<section id="projects" class="mt-12"> <section id="projects" class="mt-12">
<div class="md:flex justify-center"> <div class="md:flex justify-center">
{{ partial "home_title" (dict "title" "Projects") }} {{ partial "home_title" (dict "title" "Projects") }}
</div> </div>
{{if $data.skills.list}}
<div <div
class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"
> >
@ -93,6 +110,9 @@
</div> </div>
{{end}} {{end}}
</div> </div>
{{else}}
<div class="mt-4 text-xl text-center">Projects does not exist</div>
{{end}}
</section> </section>
</main> </main>
</div> </div>