Add basic layout

This commit is contained in:
dolphinau 2025-08-09 23:03:01 +02:00
parent 4a087959fc
commit 110765ecc7
8 changed files with 120 additions and 3 deletions

0
assets/css/main.css Normal file
View file

View file

@ -2,3 +2,28 @@ baseURL = 'https://adlc.dawl.fr/'
languageCode = 'fr' languageCode = 'fr'
title = 'Les amis de la chapelle Victoria' title = 'Les amis de la chapelle Victoria'
disableKinds = ['taxonomy', 'term'] disableKinds = ['taxonomy', 'term']
[menu]
[[menu.main]]
identifier = "concerts"
name = "Concerts"
url = "/"
weight = 1
[[menu.main]]
identifier = "galerie"
name = "Galerie"
url = "/galerie/"
weight = 5
[[menu.main]]
identifier = "apropos"
name = "A propos"
url = "/apropos/"
weight = 10
[[menu.main]]
identifier = "contact"
name = "Contact"
url = "/contact/"
weight = 10

View file

@ -1,7 +1,20 @@
<!doctype html> <!doctype html>
<html lang="fr" charset="utf-8"> <html
<head> </head> lang="{{ site.Language.LanguageCode }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}"
>
<head>
{{ partial "head.html" . }}
</head>
<body> <body>
<header>
{{ partial "header.html" . }}
</header>
<main>
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</main>
<footer>
{{ partial "footer.html" . }}
</footer>
</body> </body>
</html> </html>

View file

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

View file

@ -0,0 +1,10 @@
<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" . }}

View file

@ -0,0 +1,14 @@
{{- 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

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

View file

@ -0,0 +1,52 @@
{{- /*
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 }}