Konfiguration von Seiten-Verknüpfungen nach Gespräch mit Marc geändert.

This commit is contained in:
2022-06-16 09:48:18 +02:00
parent 706ec88576
commit d8e4f9c902
10 changed files with 197 additions and 103 deletions

View File

@@ -4,7 +4,6 @@
import { generalInfo, currentLang, location } from "../../store"
import { navigate } from "svelte-routing"
import Image from "../widgets/Image.svelte"
import ArticlesList from "../widgets/ArticlesList.svelte"
import ArticleDetails from "../routes/ArticleDetails.svelte"
@@ -14,7 +13,6 @@
let content: Content
let article: TibiArticle
let connectedContentNotFound: boolean = false
$: currentDomain = window.location.protocol + "//" + window.location.host
const loadContent = (type?: string) => {
// Set default API call filter
@@ -29,9 +27,9 @@
}
// Changed filter to find simmilar content for changed language
if (type === "changedLanguage" && content?.tags) {
if (type === "changedLanguage" && content?.pages) {
filter = {
tags: { $in: content?.tags },
_id: { $in: content?.pages },
locale: $currentLang,
}
delete filter.path
@@ -118,6 +116,12 @@
content = null
article = null
// Update current language when lang in URL not equal to current language
let pathParts = window.location.pathname.split("/")
if (pathParts.length > 3 && $currentLang !== pathParts[1]) {
$currentLang = pathParts[1]
}
if (window.location.pathname.endsWith("/")) {
loadContent()
} else {