mirror of
https://github.com/michivonah/website-v3.git
synced 2025-12-22 21:36:28 +01:00
create facts section & by the way reengineer the IntersectionObserver function
This commit is contained in:
parent
7e6957ce7e
commit
a7df408049
11 changed files with 175 additions and 18 deletions
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
{{ partial "projects.html" . }}
|
||||
|
||||
{{ partial "facts.html" . }}
|
||||
|
||||
{{ partial "faq.html" . }}
|
||||
</div>
|
||||
|
||||
|
|
|
|||
34
layouts/partials/facts.html
Normal file
34
layouts/partials/facts.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<div id="facts" class="facts">
|
||||
<div class="facts-intro fade-up">
|
||||
{{ with .Site.GetPage "facts" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
<p>{{ .Content }}</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="fact-container">
|
||||
{{ $url := .Site.Params.factsUrl }}
|
||||
{{ with try (resources.GetRemote $url) }}
|
||||
{{ with .Err }}
|
||||
{{ errorf "%s" . }}
|
||||
{{ else with .Value }}
|
||||
{{ $facts := . | transform.Unmarshal }}
|
||||
{{ if $facts }}
|
||||
{{ range $fact := $facts }}
|
||||
{{ $count := 0 }}
|
||||
{{ if isset $fact "total" }}
|
||||
{{ $count = $fact.total }}
|
||||
{{ else if isset $fact "items" }}
|
||||
{{ $count = len $fact.items }}
|
||||
{{ end }}
|
||||
<div class="fact fade-up">
|
||||
<p class="fact-counter" data-count="{{ $count }}"></p>
|
||||
<p>{{ index $fact.titles $.Lang }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ errorf "Unable to get remote resource %q" $url }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
<a href="#" alt='{{ T "home" }}'>{{ T "home" }}</a>
|
||||
<a href="#about" alt='{{ T "about" }}'>{{ T "about" }}</a>
|
||||
<a href="#projects" alt='{{ T "projects" }}'>{{ T "projects" }}</a>
|
||||
<a href="#facts" alt='{{ T "facts" }}'>{{ T "facts" }}</a>
|
||||
<a href="#faq" alt='{{ T "faq-short" }}'>{{ T "faq-short" }}</a>
|
||||
<a href="https://blog.michivonah.ch" alt='{{ T "blog" }}'>{{ T "blog" }}</a>
|
||||
<a href="#contact" alt='{{ T "contact" }}'>{{ T "contact" }}</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue