Splash page with language choice

Hello Hugos,

I’m trying to set a splash screen with two buttons for different languages, like so:

<div class="preloader" style="z-index: 9999;">
  {{ range $.Site.Home.AllTranslations }}
  <button> <a href="{{ .Permalink }}">{{ .Language.languageName }}</a> </button>
  {{ end }}

Then the script going with it:

$(".btn").mouseup(function() {

Now my problem is that of course the root page is refreshed when one of the buttons is clicked and the .preloader comes unenviably back up.

Would there be a solution to have it removed when one of the buttons is clicked…?
Or is there a way to have my splash screen on a page BEFORE baseof.html…??

I’m struggling a bit so any help is welcomed.
Kindly regards

how I would try it

define a “splash” language as defaultContentLanguage
create your select splash page as home-page for this “splash” language
Range should exclude the current (splash) language

1 Like

Oww smart, smart :face_with_monocle:
I’m going to try that right away, thank you for the advice ju52

— edit: —
Yes it works, thank you ju52 for the tip! I’ve ranged the languages in order to exclude the “splash” one, then created a baseof.xx.html for each active languages.

However now all my static files (css, plugins, etc…) are pointing to a language subdirectory, for instance: …/en/images/somepic.jpg
I wouldn’t like having to duplicate all my asset files, would there be a way to have a common asset directory for all the languages…?

Sorry if I’m asking too much in the thread, I might have to create a new one for this question.

not so nice workaround

put the images under /static/img/pic.jpg
call it with {{< figure src="/img/pic.jpg" title="Picture" >}}

1 Like

Hello again Gerhard,

thank you for the hint with the shortcode. I’ve been searching around from there and the solution came up very simple in fact (how I like it). I just put the {{ .Site.BaseURL }} variable in front of my source path so it gets directly to the folder without passing by a /en or what ever other language.

Like so:
<source src="{{ .Site.BaseURL }}sounds/tambourine.mp3" type="audio/mpeg"></source>

Works fine now.
Thank you again sir :+1:

<source src="/sounds/tambourine.mp3" type="audio/mpeg"></source>

should work too.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.