Navigation und Content-Pages so angepasst, dass über einen Language-Chooser die Sprache der Seite gewechselt werden kann und automatisch auch der reload der Content-Page angestoßen wird.

This commit is contained in:
2022-05-25 15:37:15 +02:00
parent 516c35dcb4
commit 9188148fe7
7 changed files with 78 additions and 30 deletions

View File

@@ -2,12 +2,15 @@
import { getContent } from "../../api"
import { generalInfo, currentLang } from "../../store"
import Image from "../widgets/Image.svelte"
export let path: string
let loading = true
let content: Content
let currentDomain = window.location.protocol + "//" + window.location.host
function load() {
const load = () => {
loading = true
getContent(path, $currentLang)
.then((c) => {
@@ -18,6 +21,10 @@
})
}
currentLang.subscribe(() => {
load()
})
$: if (path) load()
</script>
@@ -34,6 +41,31 @@
{#each content.blocks || [] as b}
{JSON.stringify(b)}
{/each}
{:else}
<div class="page-404">
<div>
<Image
file="{$generalInfo?.media?.brand}"
alt="{$generalInfo?.meta?.metaTitle}"
cssClass="brand"
/>
</div>
<h1>Seite nicht gefunden!</h1>
<p class="mb-md">
<strong>{path}</strong>
</p>
<p>
Die gesuchte Seite existiert nicht oder es ist ein anderer Fehler aufgetreten.<br />
Gehen Sie zurück oder gehen Sie zu <a href="/"><strong>{currentDomain}</strong></a>, um eine
neue Richtung zu wählen.
</p>
<p>
The page you are looking for doesn't exist or an other error occurred.<br />
Go back, or head over to <a href="/"><strong>{currentDomain}</strong></a> to choose a new direction.
</p>
</div>
{/if}
</div>
</div>