feat(index): animation index

This commit is contained in:
anael committed 2026-11-17 22:13:33 +01:00
1 parent 035e280d65
commit 10ed8ce826
8 files changed
+158 -31

No files matched your search

+100
View File
@@ -0,0 +1,100 @@
{{ define "main" }}
<section class="home-about">
<div class="avatar">
{{ if isset .Site.Params "avatarurl" }}
<img class={{ .Site.Params.AvatarSize | default "size-m" }} src='{{ .Scratch.Get "avatarImgSrc" }}' alt="{{ .Site.Params.AvatarAltText|default "avatar" }}">
{{ end }}
</div>
<!-- TITRE DYNAMIQUE -->
<h1 class="dynamic-heading">
{{ .Site.Title }} <span id="dynamic-text">GNU/Linux</span>
</h1>
<script>
(function () {
const words = [
"GNU/Linux",
"libriste convaincu",
"passionné"
];
let index = 0;
function initDynamicTitle() {
const element = document.getElementById("dynamic-text");
if (!element) return;
setInterval(function () {
index = (index + 1) % words.length;
element.style.opacity = "0";
setTimeout(function () {
element.textContent = words[index];
element.style.opacity = "1";
}, 300);
}, 2500);
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", initDynamicTitle);
} else {
initDynamicTitle();
}
})();
</script>
{{ if isset .Site.Params "description" }}
<h2>{{ .Site.Params.Description }}</h2>
{{ end }}
</section>
<div class="flex-break"></div>
{{ if isset .Site.Params "socialicons" }}
<div class="gk-social-icons">
<ul class="gk-social-icons-list">
{{ range .Site.Params.SocialIcons }}
<li class="gk-social-icon">
<a href="{{ .url }}" target="_blank" rel="{{ if .rel }}{{ .rel }} {{ end }}noopener noreferrer" aria-label="Learn more on {{ .name }}">
<img class="svg-inject" src="{{ relURL "svg/icons/" }}{{ .name | lower }}.svg" alt="">
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if (or
(and (fileExists "content/_index.md") .Content)
(fileExists "content/index-about.md")) }}
<section class="home-content">
{{ or .Content (readFile "index-about.md" | markdownify) }}
</section>
{{ end }}
{{ if isset .Site.Params "showpostsonhomepage" }}
<div class="home-posts list-posts">
<h2>{{ i18n (.Site.Params.ShowPostsOnHomePage | humanize) }}</h2>
{{ $posts := where .Site.Pages "Params.type" "post" }}
{{ if eq .Site.Params.ShowPostsOnHomePage "popular" }}
{{ range $posts.ByWeight | first (or .Site.Params.NumberPostsOnHomePage 4) }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ else if eq .Site.Params.ShowPostsOnHomePage "recent" }}
{{ range $posts.ByDate.Reverse | first (or .Site.Params.NumberPostsOnHomePage 4) }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}