Skip to content

Commit

Permalink
eviter les redirections pour la langue FR par default
Browse files Browse the repository at this point in the history
  • Loading branch information
schassande committed Dec 10, 2023
1 parent 0ca6b54 commit 5306e37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
23 changes: 12 additions & 11 deletions src/components/Menu.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import cfp from '../data/cfp.json';
const lang = (Astro.locals as any).lang;
const path = (Astro.locals as any).path;
const url_prefix = lang === 'fr' ? '' : '/' + lang;
const path_en = path.indexOf('/fr/') < 0 ? '/en'+path : path.replace('/fr/','/en/');
const path_fr = path.replace('/en/','/');
---
<header>
<nav id="snc-header" class="navbar navbar-expand-lg">
<a class="navbar-brand" href={'/'+lang+'/'}>
<a class="navbar-brand" href={url_prefix+'/'}>
<img src="/img/alpes-snow-full-illustration.webp" alt="Logo">
</a>

Expand All @@ -20,27 +21,27 @@ const path_fr = path.replace('/en/','/');
Snowcamp <span class="caret"></span>
</a>
<div class="dropdown-menu" aria-labelledby="navSnowcampDropdown">
<a class="dropdown-item" href={'/'+lang+'/snowcamp/#what'}>{t("what_is_this")}</a>
<a class="dropdown-item" href={'/'+lang+'/organisation/'}>Organisation</a>
<a class="dropdown-item" href={'/'+lang+'/previous-editions/'}>{t("past_editions")}</a>
<a class="dropdown-item" href={url_prefix+'/snowcamp/#what'}>{t("what_is_this")}</a>
<a class="dropdown-item" href={url_prefix+'/organisation/'}>Organisation</a>
<a class="dropdown-item" href={url_prefix+'/previous-editions/'}>{t("past_editions")}</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href={'/'+lang+'/#program'}>
<li class="nav-item"><a class="nav-link" href={url_prefix+'/#program'}>
{ cfp.status !== "published" ? t("program_translation") : t("schedule_translation") }
</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href={'/'+lang+'/#sponsors'} id="navSponsorsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="nav-link dropdown-toggle" href={url_prefix+'/#sponsors'} id="navSponsorsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Sponsors <span class="caret"></span>
</a>
<div class="dropdown-menu" aria-labelledby="navSponsorsDropdown">
<a class="dropdown-item" href={'/'+lang+'/#sponsors'}>{t("our_sponsors")}</a>
<a class="dropdown-item" href={'/'+lang+'/sponsors/'}> {t("become_sponsor")} </a>
<a class="dropdown-item" href={url_prefix+'/#sponsors'}>{t("our_sponsors")}</a>
<a class="dropdown-item" href={url_prefix+'/sponsors/'}> {t("become_sponsor")} </a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href={'/'+lang+'/#venue'}> {t("venue")} </a></li>
<li class="nav-item"><a class="nav-link" href={'/'+lang+'/tickets/'}>{t("tickets")}</a></li>
<li class="nav-item"><a class="nav-link" href={url_prefix+'/#venue'}> {t("venue")} </a></li>
<li class="nav-item"><a class="nav-link" href={url_prefix+'/tickets/'}>{t("tickets")}</a></li>
<li class="nav-item"><a class="nav-link" href="https://www.youtube.com/channel/UCvRA5NSOfGOPet90fdV7uuw/videos" target="_blank">{t("videos")}</a></li>
<li class="nav-item"><a class="nav-link" href={'/'+lang+'/coc/'}>{t("coc")}</a></li>
<li class="nav-item"><a class="nav-link" href={url_prefix+'/coc/'}>{t("coc")}</a></li>
<li class="nav-item"><a class="nav-link" href={lang == "fr" ? path_en : path_fr}>
{ lang == "fr" ?
<img class="snc-flag" src="/img/gb.svg" alt="Switch to English">
Expand Down
3 changes: 2 additions & 1 deletion src/components/SponsorsLogosSection.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { t } from "../i18n/i18n";
import SponsorsLogos from './SponsorsLogos.astro';
const lang = (Astro.locals as any).lang;
const url_prefix = lang === 'fr' ? '' : '/' + lang;
const sponsors_year = sponsors.display === 'previous' ? edition.previous_edition_year : edition.year
---
<div id="sponsors" class="snc-sponsors">
Expand Down Expand Up @@ -43,7 +44,7 @@ const sponsors_year = sponsors.display === 'previous' ? edition.previous_edition
<SponsorsLogos sponsors={sponsors.flocon} column_number={3} sponsor_title={t('sponsor_flocon')}></SponsorsLogos>
: ''}
<div class="sponsors-btn-area">
<a class="snc-btn snc-btn-big" href={'/'+lang+'/sponsors/index.html'}><span>{t('become_sponsor')}</span></a>
<a class="snc-btn snc-btn-big" href={url_prefix+'/sponsors/index.html'}><span>{t('become_sponsor')}</span></a>
</div>
{sponsors.partners && sponsors.partners.length ?
<SponsorsLogos sponsors={sponsors.partners} column_number={3} sponsor_title={t('partners')}></SponsorsLogos>
Expand Down

0 comments on commit 5306e37

Please sign in to comment.