Nice homepage

This commit is contained in:
zuma 2025-04-17 14:18:00 +02:00
parent 864a454e80
commit ec78892665
22 changed files with 278 additions and 157 deletions

View file

@ -1 +0,0 @@
<p>Copyright {{ now.Year }}. All rights reserved.</p>

View file

@ -1,5 +0,0 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
{{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }}

View file

@ -1,9 +0,0 @@
{{- with resources.Get "css/main.css" }}
{{- if eq hugo.Environment "development" }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{- else }}
{{- with . | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{- end }}
{{- end }}
{{- end }}

View file

@ -1,12 +0,0 @@
{{- with resources.Get "js/main.js" }}
{{- if eq hugo.Environment "development" }}
{{- with . | js.Build }}
<script src="{{ .RelPermalink }}"></script>
{{- end }}
{{- else }}
{{- $opts := dict "minify" true }}
{{- with . | js.Build $opts | fingerprint }}
<script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous"></script>
{{- end }}
{{- end }}
{{- end }}

View file

@ -1,2 +0,0 @@
<h1>{{ site.Title }}</h1>
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}

View file

@ -1,51 +0,0 @@
{{- /*
Renders a menu for the given menu ID.
@context {page} page The current page.
@context {string} menuID The menu ID.
@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
*/}}
{{- $page := .page }}
{{- $menuID := .menuID }}
{{- with index site.Menus $menuID }}
<nav>
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
</nav>
{{- end }}
{{- define "partials/inline/menu/walk.html" }}
{{- $page := .page }}
{{- range .menuEntries }}
{{- $attrs := dict "href" .URL }}
{{- if $page.IsMenuCurrent .Menu . }}
{{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
{{- else if $page.HasMenuCurrent .Menu .}}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }}
{{- $name := .Name }}
{{- with .Identifier }}
{{- with T . }}
{{- $name = . }}
{{- end }}
{{- end }}
<li>
<a
{{- range $k, $v := $attrs }}
{{- with $v }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end -}}
>{{ $name }}</a>
{{- with .Children }}
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
{{- end }}
</li>
{{- end }}
{{- end }}

View file

@ -0,0 +1,93 @@
{{ $direction := .direction | default "up" }}
{{ $context := .context }}
<div class="scrolling-posts-container">
<div class="scrolling-posts-inner">
<div class="scrolling-posts {{ $direction }}-scroll">
{{- $pages := where $context.Site.RegularPages "Section" "ne" "" -}}
{{- range (sort $pages "Date" "desc") -}}
<a href="{{ .RelPermalink }}" class="scrolling-posts-item">
<span class="section-badge">{{ .Section }}</span>
<span>{{ .Title }} ({{ .Date.Format "2006-01-02" }})</span>
</a>
{{- end -}}
</div>
<div class="scrolling-posts {{ $direction }}-scroll">
{{- $pages := where $context.Site.RegularPages "Section" "ne" "" -}}
{{- range (sort $pages "Date" "desc") -}}
<a href="{{ .RelPermalink }}" class="scrolling-posts-item">
<span class="section-badge">{{ .Section }}</span>
<span>{{ .Title }} ({{ .Date.Format "2006-01-02" }})</span>
</a>
{{- end -}}
</div>
</div>
</div>
<style>
.scrolling-posts-container {
width: 100%;
border: none;
overflow: hidden;
height: 100%;
}
.scrolling-posts-inner {
display: flex;
flex-direction: column;
white-space: nowrap;
padding: 0;
margin: 0;
}
.scrolling-posts {
display: flex;
flex-direction: column;
gap: 1rem;
}
.scrolling-posts > a:nth-child(1) {
margin-top: 1rem;
}
.scrolling-posts-item {
padding: 10px;
border: solid 1px #ccc;
}
.section-badge {
display: inline-block;
font-size: 0.8em;
padding: 2px 6px;
margin-right: 5px;
background-color: #f0f0f0;
border-radius: 3px;
color: #666;
}
.up-scroll {
animation: scrollUp 10s linear infinite;
}
.down-scroll {
animation: scrollDown 10s linear infinite;
}
@keyframes scrollUp {
0% {
transform: translateY(0%);
}
100% {
transform: translateY(-100%);
}
}
@keyframes scrollDown {
0% {
transform: translateY(-100%);
}
100% {
transform: translateY(0);
}
}
</style>

View file

@ -1,23 +0,0 @@
{{- /*
For a given taxonomy, renders a list of terms assigned to the page.
@context {page} page The current page.
@context {string} taxonomy The taxonomy.
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
*/}}
{{- $page := .page }}
{{- $taxonomy := .taxonomy }}
{{- with $page.GetTerms $taxonomy }}
{{- $label := (index . 0).Parent.LinkTitle }}
<div>
<div>{{ $label }}:</div>
<ul>
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
</div>
{{- end }}