Möglichkeit, in die Artikel-Details zu springen implementiert, ohne einen extra URL Pfad zu benötigen.

This commit is contained in:
2022-06-15 11:06:47 +02:00
parent 65e8b7ffc8
commit 652f15830d
11 changed files with 78 additions and 18 deletions

View File

@@ -1,7 +1,6 @@
<script lang="ts">
import { fade } from "svelte/transition"
import { _ } from "svelte-i18n"
// import { navigate } from "svelte-routing"
import { navigate, link } from "svelte-routing"
import TibiArticleMediaFile from "./TibiArticleMediaFile.svelte"
@@ -9,6 +8,7 @@
export let cssClass: string = ""
export let showDetails: boolean = false
let path = window.location.pathname
let article = null
if (entry) {
article = entry.article
@@ -201,6 +201,21 @@
{#if article?.content?.types?.details && showDetails}
<div class="article-details">{@html article?.content?.types?.details}</div>
{:else if article?.content?.types?.details}
<a
use:link
href="{`${path}${encodeURIComponent(
article?.content?.slug
? article?.content?.slug
.toLowerCase()
.replace(/[^a-zA-Z0-9]/g, '-')
.replaceAll('---', '--')
: entry.id
)}`}"
class="article-link"
>
{@html article?.link?.text ? article?.link?.text : $_("details")}
</a>
{/if}
</div>
</div>