Konfiguration von Seiten-Verknüpfungen nach Gespräch mit Marc geändert.
This commit is contained in:
parent
706ec88576
commit
d8e4f9c902
@ -38,21 +38,21 @@ meta:
|
|||||||
- source: article.general.locale
|
- source: article.general.locale
|
||||||
type: flag
|
type: flag
|
||||||
# Filter Navigation-Items in Collection-Navigation
|
# Filter Navigation-Items in Collection-Navigation
|
||||||
navigationFilter:
|
# navigationFilter:
|
||||||
- label: { de: "News", en: "News" }
|
# - label: { de: "News", en: "News" }
|
||||||
mdiIcon: filter-outline
|
# mdiIcon: filter-outline
|
||||||
params:
|
# params:
|
||||||
- sort: article.general.sort
|
# - sort: article.general.sort
|
||||||
|
# # - s.article.general.public: true
|
||||||
|
# - w.article.content.title: lor
|
||||||
|
# - s.article.general.locale: de
|
||||||
|
# - label: { de: "Diam", en: "Diam" }
|
||||||
|
# mdiIcon: filter-outline
|
||||||
|
# params:
|
||||||
|
# - sort: article.general.sort
|
||||||
# - s.article.general.public: true
|
# - s.article.general.public: true
|
||||||
- w.article.content.title: lor
|
# - w.article.content.title: diam
|
||||||
- s.article.general.locale: de
|
# - s.article.general.locale: de
|
||||||
- label: { de: "Diam", en: "Diam" }
|
|
||||||
mdiIcon: filter-outline
|
|
||||||
params:
|
|
||||||
- sort: article.general.sort
|
|
||||||
- s.article.general.public: true
|
|
||||||
- w.article.content.title: diam
|
|
||||||
- s.article.general.locale: de
|
|
||||||
|
|
||||||
imageFilter:
|
imageFilter:
|
||||||
xs:
|
xs:
|
||||||
|
@ -55,6 +55,12 @@ meta:
|
|||||||
source: meta
|
source: meta
|
||||||
subFields:
|
subFields:
|
||||||
- source: meta
|
- source: meta
|
||||||
|
- name: assignments
|
||||||
|
meta:
|
||||||
|
label: { de: "Verknüpfungen", en: "Assignments" }
|
||||||
|
source: meta
|
||||||
|
subFields:
|
||||||
|
- source: pages
|
||||||
|
|
||||||
imageFilter:
|
imageFilter:
|
||||||
xs:
|
xs:
|
||||||
@ -135,13 +141,32 @@ fields:
|
|||||||
de: "Der Pfad muss eindeutig sein und ohne ein Slash (/) beginnen und enden."
|
de: "Der Pfad muss eindeutig sein und ohne ein Slash (/) beginnen und enden."
|
||||||
en: "The path must be unique and must start and end without a slash (/)."
|
en: "The path must be unique and must start and end without a slash (/)."
|
||||||
- !include fields/_locale.yml
|
- !include fields/_locale.yml
|
||||||
|
- name: pages
|
||||||
|
type: string[]
|
||||||
|
meta:
|
||||||
|
hideInRoot: true
|
||||||
|
helperText:
|
||||||
|
de: "Verknüpft Seiten mit beliebigen anderen Seiten."
|
||||||
|
en: "Links the page to any other page."
|
||||||
|
widget: chipArray
|
||||||
|
label:
|
||||||
|
de: Verknüpfung zu Seiten
|
||||||
|
en: Assignment to pages
|
||||||
|
defaultValue: []
|
||||||
|
choices:
|
||||||
|
endpoint: "content"
|
||||||
|
mapping:
|
||||||
|
id: "id"
|
||||||
|
name: "path"
|
||||||
|
params:
|
||||||
|
sort: "path"
|
||||||
- name: tags
|
- name: tags
|
||||||
type: string[]
|
type: string[]
|
||||||
meta:
|
meta:
|
||||||
hideInRoot: true
|
hideInRoot: true
|
||||||
helperText:
|
helperText:
|
||||||
de: "Seiten können miteinander verknüpft werden. Entsprechende Seiten in einer anderen Sprache, die mit den selben zugewiesenen Schlagworten gekennzeichnet sind, können bei Umschaltung der Seitensprache gefunden werden. Wählen Sie einen existierenden Eintrag aus der Liste oder geben Sie ein neues Schlagwort ein und bestätigen mit Enter."
|
de: "Über die Zuweisung von Schlagworten, können Seiten noch einmal genauer kategorisiert werden."
|
||||||
en: "Pages can be linked together. Corresponding pages in another language, marked with the same assigned keywords, can be found by switching the page language. Select an existing entry from the list or enter a new keyword and confirm with Enter."
|
en: "Pages can be categorized more precisely by assigning keywords."
|
||||||
widget: chipArray
|
widget: chipArray
|
||||||
label:
|
label:
|
||||||
de: Schlagwort / Tag / Label
|
de: Schlagwort / Tag / Label
|
||||||
|
60
api/collections/fields/article/_article-assignments.yml
Normal file
60
api/collections/fields/article/_article-assignments.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
name: assignments
|
||||||
|
type: object
|
||||||
|
meta:
|
||||||
|
label: { de: "Verknüpfung", en: "Assignment" }
|
||||||
|
subFields:
|
||||||
|
- name: pages
|
||||||
|
type: string[]
|
||||||
|
meta:
|
||||||
|
helperText:
|
||||||
|
de: "Verknüpft den Artikel mit beliebigen Seiten."
|
||||||
|
en: "Links the article to any page."
|
||||||
|
widget: chipArray
|
||||||
|
label:
|
||||||
|
de: Verknüpfung zu Seiten
|
||||||
|
en: Assignment to pages
|
||||||
|
defaultValue: []
|
||||||
|
choices:
|
||||||
|
endpoint: "content"
|
||||||
|
mapping:
|
||||||
|
id: "path"
|
||||||
|
name: "path"
|
||||||
|
params:
|
||||||
|
sort: "path"
|
||||||
|
- name: articles
|
||||||
|
type: string[]
|
||||||
|
meta:
|
||||||
|
helperText:
|
||||||
|
de: "Verknüpft den Artikel mit beliebigen Artikeln."
|
||||||
|
en: "Links the article to any articles."
|
||||||
|
widget: chipArray
|
||||||
|
label:
|
||||||
|
de: Verknüpfung zu Artikeln
|
||||||
|
en: Assignment to articles
|
||||||
|
defaultValue: []
|
||||||
|
choices:
|
||||||
|
endpoint: "articles"
|
||||||
|
mapping:
|
||||||
|
id: "id"
|
||||||
|
name: "title"
|
||||||
|
params:
|
||||||
|
sort: "title"
|
||||||
|
- name: tags
|
||||||
|
type: string[]
|
||||||
|
meta:
|
||||||
|
helperText:
|
||||||
|
de: "Über die Zuweisung von Schlagworten, können Artikel noch einmal genauer kategorisiert werden."
|
||||||
|
en: "Articles can be categorized more precisely by assigning keywords."
|
||||||
|
widget: chipArray
|
||||||
|
label:
|
||||||
|
de: Tags / Schlagworte / Labels
|
||||||
|
en: Tags
|
||||||
|
addAllowed: true
|
||||||
|
defaultValue: []
|
||||||
|
choices:
|
||||||
|
endpoint: "tags"
|
||||||
|
mapping:
|
||||||
|
id: "name"
|
||||||
|
name: "name"
|
||||||
|
params:
|
||||||
|
sort: "name"
|
@ -40,43 +40,6 @@ subFields:
|
|||||||
- { id: "default", name: { de: "Artikel", en: "Article" } }
|
- { id: "default", name: { de: "Artikel", en: "Article" } }
|
||||||
- { id: "news", name: { de: "News", en: "News" } }
|
- { id: "news", name: { de: "News", en: "News" } }
|
||||||
- !include ../_locale.yml
|
- !include ../_locale.yml
|
||||||
- name: tags
|
|
||||||
type: string[]
|
|
||||||
meta:
|
|
||||||
helperText:
|
|
||||||
de: "Über die Zuweisung von Schlagworten, können Artikel kategorisiert werden."
|
|
||||||
en: "Articles can be categorized by assigning keywords."
|
|
||||||
widget: chipArray
|
|
||||||
label:
|
|
||||||
de: Schlagworte / Tags / Labels
|
|
||||||
en: Linking Tags
|
|
||||||
addAllowed: true
|
|
||||||
defaultValue: []
|
|
||||||
choices:
|
|
||||||
endpoint: "tags"
|
|
||||||
mapping:
|
|
||||||
id: "name"
|
|
||||||
name: "name"
|
|
||||||
params:
|
|
||||||
sort: "name"
|
|
||||||
- name: pages
|
|
||||||
type: string[]
|
|
||||||
meta:
|
|
||||||
helperText:
|
|
||||||
de: "Zuordnung zu Seiten"
|
|
||||||
en: "Assignment to Pages"
|
|
||||||
widget: chipArray
|
|
||||||
label:
|
|
||||||
de: Seiten
|
|
||||||
en: Pages
|
|
||||||
defaultValue: []
|
|
||||||
choices:
|
|
||||||
endpoint: "content"
|
|
||||||
mapping:
|
|
||||||
id: "path"
|
|
||||||
name: "path"
|
|
||||||
params:
|
|
||||||
sort: "path"
|
|
||||||
- name: publish_date
|
- name: publish_date
|
||||||
type: object
|
type: object
|
||||||
meta:
|
meta:
|
||||||
@ -151,7 +114,7 @@ subFields:
|
|||||||
label:
|
label:
|
||||||
de: Inhalt dieses Artikel
|
de: Inhalt dieses Artikel
|
||||||
en: Article Content
|
en: Article Content
|
||||||
activeTab: 2
|
activeTab: 0
|
||||||
subFields:
|
subFields:
|
||||||
- name: teaser
|
- name: teaser
|
||||||
type: string
|
type: string
|
||||||
@ -194,3 +157,4 @@ subFields:
|
|||||||
- !include _article-layout-margin.yml
|
- !include _article-layout-margin.yml
|
||||||
- !include _article-layout-padding.yml
|
- !include _article-layout-padding.yml
|
||||||
- !include _article-link.yml
|
- !include _article-link.yml
|
||||||
|
- !include _article-assignments.yml
|
||||||
|
@ -141,12 +141,23 @@ x-url: &url
|
|||||||
meta:
|
meta:
|
||||||
widget: select
|
widget: select
|
||||||
label: { de: Zielfenster, en: Target }
|
label: { de: Zielfenster, en: Target }
|
||||||
defaultValue: "_self"
|
defaultValue: "default"
|
||||||
choices:
|
choices:
|
||||||
|
- { id: "default", name: "Gleicher Tab oder Seite (ohne Refresh)" }
|
||||||
- { id: "_self", name: "Gleicher Tab oder Seite (Standardwert)" }
|
- { id: "_self", name: "Gleicher Tab oder Seite (Standardwert)" }
|
||||||
- { id: "_blank", name: "Neuer Tab oder Fenster" }
|
- { id: "_blank", name: "Neuer Tab oder Fenster" }
|
||||||
- { id: "_parent", name: "Elternfenster" }
|
- { id: "_parent", name: "Elternfenster" }
|
||||||
|
|
||||||
|
- name: hidden
|
||||||
|
type: boolean
|
||||||
|
meta:
|
||||||
|
label: { de: "Ausgeblendet", en: "Hidden" }
|
||||||
|
helperText:
|
||||||
|
{
|
||||||
|
de: "Definiert, ob der Navigationspunkt in der Navigation angezeigt werden soll oder nicht.",
|
||||||
|
en: "Defines whether the navigation point should be displayed in the navigation or not.",
|
||||||
|
}
|
||||||
|
|
||||||
x-items: &items
|
x-items: &items
|
||||||
name: items
|
name: items
|
||||||
type: object[]
|
type: object[]
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
import { generalInfo, currentLang, location } from "../../store"
|
import { generalInfo, currentLang, location } from "../../store"
|
||||||
import { navigate } from "svelte-routing"
|
import { navigate } from "svelte-routing"
|
||||||
|
|
||||||
import Image from "../widgets/Image.svelte"
|
|
||||||
import ArticlesList from "../widgets/ArticlesList.svelte"
|
import ArticlesList from "../widgets/ArticlesList.svelte"
|
||||||
import ArticleDetails from "../routes/ArticleDetails.svelte"
|
import ArticleDetails from "../routes/ArticleDetails.svelte"
|
||||||
|
|
||||||
@ -14,7 +13,6 @@
|
|||||||
let content: Content
|
let content: Content
|
||||||
let article: TibiArticle
|
let article: TibiArticle
|
||||||
let connectedContentNotFound: boolean = false
|
let connectedContentNotFound: boolean = false
|
||||||
$: currentDomain = window.location.protocol + "//" + window.location.host
|
|
||||||
|
|
||||||
const loadContent = (type?: string) => {
|
const loadContent = (type?: string) => {
|
||||||
// Set default API call filter
|
// Set default API call filter
|
||||||
@ -29,9 +27,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Changed filter to find simmilar content for changed language
|
// Changed filter to find simmilar content for changed language
|
||||||
if (type === "changedLanguage" && content?.tags) {
|
if (type === "changedLanguage" && content?.pages) {
|
||||||
filter = {
|
filter = {
|
||||||
tags: { $in: content?.tags },
|
_id: { $in: content?.pages },
|
||||||
locale: $currentLang,
|
locale: $currentLang,
|
||||||
}
|
}
|
||||||
delete filter.path
|
delete filter.path
|
||||||
@ -118,6 +116,12 @@
|
|||||||
content = null
|
content = null
|
||||||
article = 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("/")) {
|
if (window.location.pathname.endsWith("/")) {
|
||||||
loadContent()
|
loadContent()
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<ArticlesList tags="{['home']}" />
|
<ArticlesList pages="{['/']}" />
|
||||||
|
|
||||||
<GeneralMediaImage id="test1" />
|
<!-- <GeneralMediaImage id="test1" /> -->
|
||||||
|
|
||||||
<!-- <ContactForm type="recipe" collapsed="{expandedForm !== 'recipe'}" /> -->
|
<!-- <ContactForm type="recipe" collapsed="{expandedForm !== 'recipe'}" /> -->
|
||||||
<!-- <ContactForm type="contact" collapsed="{expandedForm !== 'contact'}" /> -->
|
<!-- <ContactForm type="contact" collapsed="{expandedForm !== 'contact'}" /> -->
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import Article from "../widgets/Article.svelte"
|
import Article from "../widgets/Article.svelte"
|
||||||
|
|
||||||
export let tags: string[] = null
|
export let tags: string[] = null
|
||||||
|
export let pages: string[] = null
|
||||||
export let path: string = null
|
export let path: string = null
|
||||||
|
|
||||||
let articleEntries: CollectionEntry[] = []
|
let articleEntries: CollectionEntry[] = []
|
||||||
@ -15,11 +16,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tags && tags?.length) {
|
if (tags && tags?.length) {
|
||||||
filter["article.general.tags"] = { $in: tags }
|
filter["article.assignments.tags"] = { $in: tags }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pages && pages?.length) {
|
||||||
|
filter["article.assignments.pages"] = { $in: pages }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
filter["article.general.pages"] = { $in: [path] }
|
filter["article.assignments.pages"] = { $in: [path] }
|
||||||
}
|
}
|
||||||
|
|
||||||
getArticles("articles", { filter }).then((response) => {
|
getArticles("articles", { filter }).then((response) => {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import Icon from "mdi-svelte"
|
import Icon from "mdi-svelte"
|
||||||
import { mdiMenu } from "@mdi/js"
|
import { mdiMenu } from "@mdi/js"
|
||||||
|
|
||||||
import { links } from "svelte-routing"
|
import { links, link } from "svelte-routing"
|
||||||
import { navigations, currentLang, location } from "../../store"
|
import { navigations, currentLang, location } from "../../store"
|
||||||
|
|
||||||
import LanguageChooser from "./LanguageChooser.svelte"
|
import LanguageChooser from "./LanguageChooser.svelte"
|
||||||
@ -28,7 +28,17 @@
|
|||||||
{#if navigation}
|
{#if navigation}
|
||||||
<nav class="{ident}" use:links>
|
<nav class="{ident}" use:links>
|
||||||
{#each navigation?.items || [] as item}
|
{#each navigation?.items || [] as item}
|
||||||
|
{#if !item.settings.url.hidden}
|
||||||
{#if item.settings.url.url}
|
{#if item.settings.url.url}
|
||||||
|
{#if item.settings.url.target === "default"}
|
||||||
|
<a
|
||||||
|
use:link
|
||||||
|
href="{item.settings.url.url}"
|
||||||
|
class:active="{'/' + item.settings.page === $location.path}"
|
||||||
|
>
|
||||||
|
{item.settings.title}
|
||||||
|
</a>
|
||||||
|
{:else}
|
||||||
<a
|
<a
|
||||||
href="{item.settings.url.url}"
|
href="{item.settings.url.url}"
|
||||||
target="{item.settings.url.target}"
|
target="{item.settings.url.target}"
|
||||||
@ -39,11 +49,13 @@
|
|||||||
>
|
>
|
||||||
{item.settings.title}
|
{item.settings.title}
|
||||||
</a>
|
</a>
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<a href="{item.settings.page + '/'}" class:active="{'/' + item.settings.page === $location.path}">
|
<a href="{item.settings.page + '/'}" class:active="{'/' + item.settings.page === $location.path}">
|
||||||
{item.settings.title}
|
{item.settings.title}
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -54,7 +66,17 @@
|
|||||||
|
|
||||||
<nav class="{ident}-mobile" class:show="{showMobileNav}" use:links>
|
<nav class="{ident}-mobile" class:show="{showMobileNav}" use:links>
|
||||||
{#each navigation?.items || [] as item}
|
{#each navigation?.items || [] as item}
|
||||||
|
{#if !item.settings.url.hidden}
|
||||||
{#if item.settings.url.url}
|
{#if item.settings.url.url}
|
||||||
|
{#if item.settings.url.target === "default"}
|
||||||
|
<a
|
||||||
|
use:link
|
||||||
|
href="{item.settings.url.url}"
|
||||||
|
class:active="{'/' + item.settings.page === $location.path}"
|
||||||
|
>
|
||||||
|
{item.settings.title}
|
||||||
|
</a>
|
||||||
|
{:else}
|
||||||
<div class="nav-item">
|
<div class="nav-item">
|
||||||
<a
|
<a
|
||||||
href="{item.settings.url.url}"
|
href="{item.settings.url.url}"
|
||||||
@ -67,6 +89,7 @@
|
|||||||
{item.settings.title}
|
{item.settings.title}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="nav-item">
|
<div class="nav-item">
|
||||||
<a
|
<a
|
||||||
@ -78,6 +101,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</nav>
|
</nav>
|
||||||
{/if}
|
{/if}
|
||||||
|
1
types/global.d.ts
vendored
1
types/global.d.ts
vendored
@ -166,6 +166,7 @@ interface NavigationItem {
|
|||||||
url: {
|
url: {
|
||||||
url: string
|
url: string
|
||||||
target: string
|
target: string
|
||||||
|
hidden: boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user