Fix/Feat: footer, newsletter, logo footerLogo, i18n, router formatting

- Footer : newsletter commentée, margin-top blog, text-align footer-col
- Blueprint site : logo → footerLogo (champ dédié au pied de page)
- Controller : logo → footerLogo
- i18n : newsletter_heading mis à jour (newsletters)
- site.svelte.js : retrait console.log debug
- router/index.js : reformatage quotes (linter)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-03-18 16:17:16 +01:00
parent c6fa61c77b
commit 474baf321b
7 changed files with 73 additions and 54 deletions

View file

@ -27,10 +27,12 @@ columns:
label: Description label: Description
type: textarea type: textarea
translate: true translate: true
logo: footerLogo:
label: Logo label: Logo
type: files type: files
layout: cards
max: 1 max: 1
help: Utilisé en pied de page (page À propos, Blog et Article).
- width: 1/2 - width: 1/2
fields: fields:

View file

@ -16,7 +16,7 @@ return function ($page, $kirby, $site) {
'site' => [ 'site' => [
'title' => $site->siteTitle()->value(), 'title' => $site->siteTitle()->value(),
'url' => $site->url(), 'url' => $site->url(),
'logo' => $site->logo()->toFile()?->url(), 'logo' => $site->footerLogo()->toFile()?->url(),
'language' => $kirby->language()?->code() ?? 'fr', 'language' => $kirby->language()?->code() ?? 'fr',
'languages' => $kirby->languages()->map(function($l) { 'languages' => $kirby->languages()->map(function($l) {
return [ return [

View file

@ -79,7 +79,7 @@
{/if} {/if}
<!-- Newsletter --> <!-- Newsletter -->
<div class="footer-newsletter"> <!-- <div class="footer-newsletter">
<h3>{t('newsletter_heading')}</h3> <h3>{t('newsletter_heading')}</h3>
<form class="footer-newsletter-form" onsubmit={handleSubscribe}> <form class="footer-newsletter-form" onsubmit={handleSubscribe}>
<input <input
@ -96,7 +96,7 @@
{status.message} {status.message}
</p> </p>
{/if} {/if}
</div> </div> -->
</div> </div>
@ -126,6 +126,7 @@
:global(.blog .page-scrollable-footer) { :global(.blog .page-scrollable-footer) {
margin-left: -12.4vw; margin-left: -12.4vw;
margin-top: 5rem;
} }
/* --- Main row --- */ /* --- Main row --- */
@ -139,8 +140,7 @@
/* --- Brand --- */ /* --- Brand --- */
.footer-brand img { .footer-brand img {
height: 40px; width: 60px;
width: auto;
} }
/* --- Info columns --- */ /* --- Info columns --- */
@ -149,6 +149,7 @@
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
width: 136px; width: 136px;
text-align: left;
} }
.footer-col h3 { .footer-col h3 {

View file

@ -16,15 +16,14 @@
<style> <style>
.lang-switcher { .lang-switcher {
font-size: var(--font-size-paragraph-small);
z-index: 60; z-index: 60;
position: absolute; position: absolute;
bottom: 4vh; bottom: 4vh;
left: 4vh; left: 4vh;
text-transform: uppercase; text-transform: uppercase;
color: rgb(4, 254, 160); color: rgb(4, 254, 160);
background: none; display: block;
border: none; background-color: transparent;
cursor: pointer;
padding: 0.75rem 1rem;
} }
</style> </style>

View file

@ -25,8 +25,8 @@ const dict = {
contact: { fr: "Contactez-nous", en: "Contact" }, contact: { fr: "Contactez-nous", en: "Contact" },
follow_us: { fr: "Suivez-nous", en: "Follow us" }, follow_us: { fr: "Suivez-nous", en: "Follow us" },
newsletter_heading: { newsletter_heading: {
fr: "Inscrivez-vous à notre newsletter !", fr: "Abonnez-vous à nos newsletters !",
en: "Subscribe to our newsletter!", en: "Subscribe to our newsletters!",
}, },
newsletter_placeholder: { fr: "Votre email", en: "Enter your email" }, newsletter_placeholder: { fr: "Votre email", en: "Enter your email" },
newsletter_submit: { fr: "S'inscrire", en: "Subscribe" }, newsletter_submit: { fr: "S'inscrire", en: "Subscribe" },

View file

@ -5,12 +5,12 @@ import { locale } from "@state/locale.svelte";
let siteInitialized = false; let siteInitialized = false;
function normalizePath(path) { function normalizePath(path) {
const stripped = path.replace(/^\/en(\/|$)/, '$1') || '/'; const stripped = path.replace(/^\/en(\/|$)/, "$1") || "/";
return stripped === '/' ? '/home' : stripped; return stripped === "/" ? "/home" : stripped;
} }
function apiPrefix() { function apiPrefix() {
return locale.current === 'en' ? '/en' : ''; return locale.current === "en" ? "/en" : "";
} }
/** /**
@ -80,10 +80,15 @@ export function slideTo(path, { skipHistory = false } = {}) {
path = normalizePath(path); path = normalizePath(path);
if (!skipHistory) { if (!skipHistory) {
const historyPath = locale.current === 'en' const historyPath =
? (path === '/home' ? '/en' : `/en${path}`) locale.current === "en"
: (path === '/home' ? '/' : path); ? path === "/home"
history.pushState({}, '', historyPath); ? "/en"
: `/en${path}`
: path === "/home"
? "/"
: path;
history.pushState({}, "", historyPath);
} }
const idx = findSlideIndex(path); const idx = findSlideIndex(path);
@ -102,18 +107,18 @@ export function slideTo(path, { skipHistory = false } = {}) {
export async function initRouter() { export async function initRouter() {
// Language detection: URL prefix > localStorage > navigator // Language detection: URL prefix > localStorage > navigator
const hasEnPrefix = window.location.pathname.startsWith('/en'); const hasEnPrefix = window.location.pathname.startsWith("/en");
if (hasEnPrefix) { if (hasEnPrefix) {
locale.setLanguage('en'); locale.setLanguage("en");
localStorage.setItem('wg_lang', 'en'); localStorage.setItem("wg_lang", "en");
} else if (!localStorage.getItem('wg_lang')) { } else if (!localStorage.getItem("wg_lang")) {
const navLang = navigator.language || navigator.languages?.[0] || 'fr'; const navLang = navigator.language || navigator.languages?.[0] || "fr";
if (navLang.startsWith('en')) { if (navLang.startsWith("en")) {
window.location.replace('/en' + window.location.pathname); window.location.replace("/en" + window.location.pathname);
return; return;
} }
} else if (localStorage.getItem('wg_lang') === 'en') { } else if (localStorage.getItem("wg_lang") === "en") {
window.location.replace('/en' + window.location.pathname); window.location.replace("/en" + window.location.pathname);
return; return;
} }
@ -126,9 +131,7 @@ export async function initRouter() {
slides.setActiveIndex(idx); slides.setActiveIndex(idx);
} }
loadAllSlidesInBackground( loadAllSlidesInBackground(idx !== -1 ? slides.all[idx].path : initialPath);
idx !== -1 ? slides.all[idx].path : initialPath
);
window.addEventListener("popstate", () => { window.addEventListener("popstate", () => {
const path = normalizePath(window.location.pathname); const path = normalizePath(window.location.pathname);

View file

@ -1,27 +1,41 @@
let title = $state('') let title = $state("");
let url = $state('') let url = $state("");
let language = $state('fr') let language = $state("fr");
let languages = $state([]) let languages = $state([]);
let logo = $state(null) let logo = $state(null);
let navigation = $state([]) let navigation = $state([]);
let contact = $state({}) let contact = $state({});
export const site = { export const site = {
get title() { return title }, get title() {
get url() { return url }, return title;
get language() { return language }, },
get languages() { return languages }, get url() {
get logo() { return logo }, return url;
get navigation() { return navigation }, },
get contact() { return contact }, get language() {
return language;
},
get languages() {
return languages;
},
get logo() {
return logo;
},
get navigation() {
return navigation;
},
get contact() {
return contact;
},
set: (data) => { set: (data) => {
title = data.title || '' title = data.title || "";
url = data.url || '' url = data.url || "";
language = data.language || 'fr' language = data.language || "fr";
languages = data.languages || [] languages = data.languages || [];
logo = data.logo || null logo = data.logo || null;
navigation = data.navigation || [] navigation = data.navigation || [];
contact = data.contact || {} contact = data.contact || {};
} },
} };