|
|
@ -1,33 +1,13 @@
|
|
|
|
<script lang="ts">
|
|
|
|
<script lang="ts">
|
|
|
|
import { formatDateRelative } from "$lib";
|
|
|
|
import { formatDateRelative } from "$lib";
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
|
|
|
|
import Box from "../../../components/atoms/Box.svelte";
|
|
|
|
import Box from "../../../components/atoms/Box.svelte";
|
|
|
|
import Error from "../../../components/molecules/Error.svelte";
|
|
|
|
import Error from "../../../components/molecules/Error.svelte";
|
|
|
|
import Thumbnail from "../../../components/molecules/Thumbnail.svelte";
|
|
|
|
import Thumbnail from "../../../components/molecules/Thumbnail.svelte";
|
|
|
|
import BlogPostContent from "../../../components/organisms/BlogPostContent.svelte";
|
|
|
|
import BlogPostContent from "../../../components/organisms/BlogPostContent.svelte";
|
|
|
|
import type { PageData } from "./$types";
|
|
|
|
import type { PageData } from "./$types";
|
|
|
|
import { beforeNavigate } from "$app/navigation";
|
|
|
|
|
|
|
|
import ContainerSlim from "../../../components/atoms/ContainerSlim.svelte";
|
|
|
|
import ContainerSlim from "../../../components/atoms/ContainerSlim.svelte";
|
|
|
|
|
|
|
|
|
|
|
|
export let data: PageData;
|
|
|
|
export let data: PageData;
|
|
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
|
|
|
if (!data.post) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const url = new URL(window.location.href);
|
|
|
|
|
|
|
|
const lang = url.searchParams.get("lang");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data.post.attributes.locale !== lang) {
|
|
|
|
|
|
|
|
document
|
|
|
|
|
|
|
|
.querySelector("html")
|
|
|
|
|
|
|
|
?.setAttribute("lang", data.post.attributes.locale);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beforeNavigate(() => {
|
|
|
|
|
|
|
|
document.querySelector("html")?.setAttribute("lang", "en");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<ContainerSlim>
|
|
|
|
<ContainerSlim>
|
|
|
@ -37,6 +17,7 @@
|
|
|
|
{@const teaserImage = data.post.attributes.teaserImage.data?.attributes}
|
|
|
|
{@const teaserImage = data.post.attributes.teaserImage.data?.attributes}
|
|
|
|
{@const collection = data.post.attributes.collection.data?.attributes}
|
|
|
|
{@const collection = data.post.attributes.collection.data?.attributes}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="blog-entry" lang={post.attributes.locale}>
|
|
|
|
<div class="blog-entry-head">
|
|
|
|
<div class="blog-entry-head">
|
|
|
|
<Box>
|
|
|
|
<Box>
|
|
|
|
<div class="head-text">
|
|
|
|
<div class="head-text">
|
|
|
@ -66,6 +47,7 @@
|
|
|
|
{#each post.attributes.content as contentEntry}
|
|
|
|
{#each post.attributes.content as contentEntry}
|
|
|
|
<BlogPostContent content={contentEntry} />
|
|
|
|
<BlogPostContent content={contentEntry} />
|
|
|
|
{/each}
|
|
|
|
{/each}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{:else if !data.error}
|
|
|
|
{:else if !data.error}
|
|
|
|
<Error error={{ message: "Could not find the post" }} />
|
|
|
|
<Error error={{ message: "Could not find the post" }} />
|
|
|
|
{/if}
|
|
|
|
{/if}
|
|
|
@ -73,6 +55,7 @@
|
|
|
|
{#if data.error}
|
|
|
|
{#if data.error}
|
|
|
|
<Error error={data.error} />
|
|
|
|
<Error error={data.error} />
|
|
|
|
{/if}
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
</ContainerSlim>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
<style lang="scss">
|
|
|
|
.blog-entry-head {
|
|
|
|
.blog-entry-head {
|
|
|
@ -103,4 +86,3 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
</ContainerSlim>
|
|
|
|
|
|
|
|