Content Collection um Tags ChipArray erweitert, um eine Möglichkeit zu schaffen, Stichworte zum Verknüpfen der Seiten zwischen den Sprachen zu schaffen...(WIP)
This commit is contained in:
@@ -186,10 +186,10 @@ export const sendEmail = async (type: string = "contactForm", data: any, noToken
|
||||
})
|
||||
}
|
||||
|
||||
export const getContent = async (path: string, lang: string): Promise<Content> => {
|
||||
export const getContent = async (path: string, lang: string, filter?: APIParams): Promise<Content> => {
|
||||
const c = await api<Content[]>("content", {
|
||||
limit: 1,
|
||||
filter: { path, locale: lang },
|
||||
filter: { path, locale: lang, ...filter },
|
||||
})
|
||||
if (c?.data?.length) {
|
||||
return c.data[0]
|
||||
|
||||
@@ -11,8 +11,15 @@
|
||||
let currentDomain = window.location.protocol + "//" + window.location.host
|
||||
|
||||
const load = () => {
|
||||
let filter = {}
|
||||
if (content?.tags) {
|
||||
filter = {
|
||||
tags: { $in: content?.tags },
|
||||
}
|
||||
}
|
||||
|
||||
loading = true
|
||||
getContent(path, $currentLang)
|
||||
getContent(path, $currentLang, filter)
|
||||
.then((c) => {
|
||||
content = c
|
||||
})
|
||||
@@ -31,7 +38,7 @@
|
||||
<svelte:head>
|
||||
<title>{content?.name ? content?.name + " - " : ""}{$generalInfo?.meta?.metaTitle}</title>
|
||||
</svelte:head>
|
||||
{path}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
$: languages = []
|
||||
|
||||
$: if ($navigations?.length) {
|
||||
$navigations.forEach((nav) => {
|
||||
if (!languages.includes(nav.locale)) {
|
||||
languages.push(nav.locale)
|
||||
}
|
||||
})
|
||||
languages = languages
|
||||
$: {
|
||||
if ($navigations?.length) {
|
||||
$navigations.forEach((nav) => {
|
||||
if (!languages.includes(nav.locale)) {
|
||||
languages.push(nav.locale)
|
||||
}
|
||||
})
|
||||
languages = languages
|
||||
}
|
||||
}
|
||||
|
||||
const setLanguage = (lang: string) => {
|
||||
|
||||
Reference in New Issue
Block a user