Compare commits
2 commits
c6fa61c77b
...
42ee58c18d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42ee58c18d | ||
|
|
474baf321b |
8 changed files with 75 additions and 56 deletions
|
|
@ -27,10 +27,12 @@ columns:
|
|||
label: Description
|
||||
type: textarea
|
||||
translate: true
|
||||
logo:
|
||||
footerLogo:
|
||||
label: Logo
|
||||
type: files
|
||||
layout: cards
|
||||
max: 1
|
||||
help: Utilisé en pied de page (page À propos, Blog et Article).
|
||||
|
||||
- width: 1/2
|
||||
fields:
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ return function ($page, $kirby, $site) {
|
|||
'site' => [
|
||||
'title' => $site->siteTitle()->value(),
|
||||
'url' => $site->url(),
|
||||
'logo' => $site->logo()->toFile()?->url(),
|
||||
'logo' => $site->footerLogo()->toFile()?->url(),
|
||||
'language' => $kirby->language()?->code() ?? 'fr',
|
||||
'languages' => $kirby->languages()->map(function($l) {
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title><?= $page->meta_title()->or($page->title() . ' - ' . $site->site_title()) ?></title>
|
||||
<title><?= $site->title() ?> - <?= $page->title() ?></title>
|
||||
<meta name="description" content="<?= $page->meta_description()->or($site->site_description()) ?>">
|
||||
|
||||
<!-- Favicon -->
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
{/if}
|
||||
|
||||
<!-- Newsletter -->
|
||||
<div class="footer-newsletter">
|
||||
<!-- <div class="footer-newsletter">
|
||||
<h3>{t('newsletter_heading')}</h3>
|
||||
<form class="footer-newsletter-form" onsubmit={handleSubscribe}>
|
||||
<input
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
{status.message}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -126,6 +126,7 @@
|
|||
|
||||
:global(.blog .page-scrollable-footer) {
|
||||
margin-left: -12.4vw;
|
||||
margin-top: 5rem;
|
||||
}
|
||||
|
||||
/* --- Main row --- */
|
||||
|
|
@ -139,8 +140,7 @@
|
|||
|
||||
/* --- Brand --- */
|
||||
.footer-brand img {
|
||||
height: 40px;
|
||||
width: auto;
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
/* --- Info columns --- */
|
||||
|
|
@ -149,6 +149,7 @@
|
|||
flex-direction: column;
|
||||
gap: 16px;
|
||||
width: 136px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.footer-col h3 {
|
||||
|
|
|
|||
|
|
@ -16,15 +16,14 @@
|
|||
|
||||
<style>
|
||||
.lang-switcher {
|
||||
font-size: var(--font-size-paragraph-small);
|
||||
z-index: 60;
|
||||
position: absolute;
|
||||
bottom: 4vh;
|
||||
left: 4vh;
|
||||
text-transform: uppercase;
|
||||
color: rgb(4, 254, 160);
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 0.75rem 1rem;
|
||||
display: block;
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ const dict = {
|
|||
contact: { fr: "Contactez-nous", en: "Contact" },
|
||||
follow_us: { fr: "Suivez-nous", en: "Follow us" },
|
||||
newsletter_heading: {
|
||||
fr: "Inscrivez-vous à notre newsletter !",
|
||||
en: "Subscribe to our newsletter!",
|
||||
fr: "Abonnez-vous à nos newsletters !",
|
||||
en: "Subscribe to our newsletters!",
|
||||
},
|
||||
newsletter_placeholder: { fr: "Votre email", en: "Enter your email" },
|
||||
newsletter_submit: { fr: "S'inscrire", en: "Subscribe" },
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ import { locale } from "@state/locale.svelte";
|
|||
let siteInitialized = false;
|
||||
|
||||
function normalizePath(path) {
|
||||
const stripped = path.replace(/^\/en(\/|$)/, '$1') || '/';
|
||||
return stripped === '/' ? '/home' : stripped;
|
||||
const stripped = path.replace(/^\/en(\/|$)/, "$1") || "/";
|
||||
return stripped === "/" ? "/home" : stripped;
|
||||
}
|
||||
|
||||
function apiPrefix() {
|
||||
return locale.current === 'en' ? '/en' : '';
|
||||
return locale.current === "en" ? "/en" : "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -80,17 +80,22 @@ export function slideTo(path, { skipHistory = false } = {}) {
|
|||
path = normalizePath(path);
|
||||
|
||||
if (!skipHistory) {
|
||||
const historyPath = locale.current === 'en'
|
||||
? (path === '/home' ? '/en' : `/en${path}`)
|
||||
: (path === '/home' ? '/' : path);
|
||||
history.pushState({}, '', historyPath);
|
||||
const historyPath =
|
||||
locale.current === "en"
|
||||
? path === "/home"
|
||||
? "/en"
|
||||
: `/en${path}`
|
||||
: path === "/home"
|
||||
? "/"
|
||||
: path;
|
||||
history.pushState({}, "", historyPath);
|
||||
}
|
||||
|
||||
const idx = findSlideIndex(path);
|
||||
const slidePath = idx !== -1 ? slides.all[idx].path : path;
|
||||
|
||||
if (idx !== -1 && slides.all[idx].title) {
|
||||
document.title = `${slides.all[idx].title} — World Game`;
|
||||
document.title = `World Game - ${slides.all[idx].title}`;
|
||||
}
|
||||
|
||||
slides.slideTo(slidePath);
|
||||
|
|
@ -102,18 +107,18 @@ export function slideTo(path, { skipHistory = false } = {}) {
|
|||
|
||||
export async function initRouter() {
|
||||
// Language detection: URL prefix > localStorage > navigator
|
||||
const hasEnPrefix = window.location.pathname.startsWith('/en');
|
||||
const hasEnPrefix = window.location.pathname.startsWith("/en");
|
||||
if (hasEnPrefix) {
|
||||
locale.setLanguage('en');
|
||||
localStorage.setItem('wg_lang', 'en');
|
||||
} else if (!localStorage.getItem('wg_lang')) {
|
||||
const navLang = navigator.language || navigator.languages?.[0] || 'fr';
|
||||
if (navLang.startsWith('en')) {
|
||||
window.location.replace('/en' + window.location.pathname);
|
||||
locale.setLanguage("en");
|
||||
localStorage.setItem("wg_lang", "en");
|
||||
} else if (!localStorage.getItem("wg_lang")) {
|
||||
const navLang = navigator.language || navigator.languages?.[0] || "fr";
|
||||
if (navLang.startsWith("en")) {
|
||||
window.location.replace("/en" + window.location.pathname);
|
||||
return;
|
||||
}
|
||||
} else if (localStorage.getItem('wg_lang') === 'en') {
|
||||
window.location.replace('/en' + window.location.pathname);
|
||||
} else if (localStorage.getItem("wg_lang") === "en") {
|
||||
window.location.replace("/en" + window.location.pathname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -126,9 +131,7 @@ export async function initRouter() {
|
|||
slides.setActiveIndex(idx);
|
||||
}
|
||||
|
||||
loadAllSlidesInBackground(
|
||||
idx !== -1 ? slides.all[idx].path : initialPath
|
||||
);
|
||||
loadAllSlidesInBackground(idx !== -1 ? slides.all[idx].path : initialPath);
|
||||
|
||||
window.addEventListener("popstate", () => {
|
||||
const path = normalizePath(window.location.pathname);
|
||||
|
|
|
|||
|
|
@ -1,27 +1,41 @@
|
|||
let title = $state('')
|
||||
let url = $state('')
|
||||
let language = $state('fr')
|
||||
let languages = $state([])
|
||||
let logo = $state(null)
|
||||
let navigation = $state([])
|
||||
let contact = $state({})
|
||||
let title = $state("");
|
||||
let url = $state("");
|
||||
let language = $state("fr");
|
||||
let languages = $state([]);
|
||||
let logo = $state(null);
|
||||
let navigation = $state([]);
|
||||
let contact = $state({});
|
||||
|
||||
export const site = {
|
||||
get title() { return title },
|
||||
get url() { return url },
|
||||
get language() { return language },
|
||||
get languages() { return languages },
|
||||
get logo() { return logo },
|
||||
get navigation() { return navigation },
|
||||
get contact() { return contact },
|
||||
get title() {
|
||||
return title;
|
||||
},
|
||||
get url() {
|
||||
return url;
|
||||
},
|
||||
get language() {
|
||||
return language;
|
||||
},
|
||||
get languages() {
|
||||
return languages;
|
||||
},
|
||||
get logo() {
|
||||
return logo;
|
||||
},
|
||||
get navigation() {
|
||||
return navigation;
|
||||
},
|
||||
get contact() {
|
||||
return contact;
|
||||
},
|
||||
|
||||
set: (data) => {
|
||||
title = data.title || ''
|
||||
url = data.url || ''
|
||||
language = data.language || 'fr'
|
||||
languages = data.languages || []
|
||||
logo = data.logo || null
|
||||
navigation = data.navigation || []
|
||||
contact = data.contact || {}
|
||||
}
|
||||
}
|
||||
title = data.title || "";
|
||||
url = data.url || "";
|
||||
language = data.language || "fr";
|
||||
languages = data.languages || [];
|
||||
logo = data.logo || null;
|
||||
navigation = data.navigation || [];
|
||||
contact = data.contact || {};
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue