From 432d21daeb4a0e2068b4852600fb15dc4fe26884 Mon Sep 17 00:00:00 2001 From: Mario Linz Date: Fri, 3 Jun 2022 10:49:16 +0200 Subject: [PATCH] Redirekt auf HOME, wenn keine Contentseite gefunden wurde. --- api/collections/content.yml | 10 +- api/collections/fields/_article.yml | 282 +++++++++++++-------------- api/collections/fields/_locale.yml | 2 +- src/components/routes/Content.svelte | 6 + 4 files changed, 148 insertions(+), 152 deletions(-) diff --git a/api/collections/content.yml b/api/collections/content.yml index 207f9fb..d3ffbc2 100644 --- a/api/collections/content.yml +++ b/api/collections/content.yml @@ -111,13 +111,13 @@ fields: type: string[] meta: helperText: - de: "Entsprechende Seiten in einer anderen Sprache, die mit den selben zugewiesenen Stichworten gekennzeichnet sind, können bei Umschaltung der Seitensprache gefunden werden." - en: "Corresponding pages in another language, marked with the same assigned keywords, can be found when switching the page language." + 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." + 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." widget: chipArray label: - de: Verknüpfungs-Stichworte - en: Linking Tags - defaultValue: [] + de: Schlagwort / Tag / Label + en: Kayword / Tag / Label + addAllowed: true choices: endpoint: "tags" mapping: diff --git a/api/collections/fields/_article.yml b/api/collections/fields/_article.yml index 8e30da9..8a0d681 100644 --- a/api/collections/fields/_article.yml +++ b/api/collections/fields/_article.yml @@ -62,19 +62,24 @@ subFields: choices: - { id: "content", name: { de: "Inhaltsbereich", en: "Content Area" } } - { id: "sidebar", name: { de: "Sidebar", en: "Sidebar" } } - - name: categories + - 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: Position auf der Seite - en: Position on page - defaultValue: ["c1"] - autocomplete: true + de: Verknüpfungs-Stichworte + en: Linking Tags + defaultValue: [] choices: - - { id: "c1", name: { de: "Category 1", en: "" } } - - { id: "c2", name: { de: "Category Number 2", en: "" } } - - { id: "c3", name: { de: "Best Category 3", en: "" } } + endpoint: "tags" + mapping: + id: "id" + name: "name" + params: + sort: "name" - name: sort type: number meta: @@ -105,22 +110,6 @@ subFields: type: string meta: label: { de: "Untertitel", en: "Subtitle" } - - name: panel1 - type: object - meta: - widget: panel - label: { de: "Test Panel", en: "Test Panel" } - subFields: - - name: radioGroup1 - type: string[] - meta: - widget: radioGroup - label: { de: "Radio Button Group", en: "Radio Button Group" } - defaultValue: ["r2"] - choices: - - { id: "r1", name: { de: "Radio 1", en: "" } } - - { id: "r2", name: { de: "Noch ein Radio 2", en: "" } } - - { id: "r3", name: { de: "R 3", en: "" } } - name: types type: object meta: @@ -202,11 +191,7 @@ subFields: - name: layout type: object meta: - widget: tabs - label: - de: Layout - en: Layout - css: + label: { de: Layout, en: Layout } subFields: - name: variant type: string @@ -248,128 +233,133 @@ subFields: id: "bottom-right", name: { de: "Artikelbild unten rechts", en: "Article picture below right" }, } - - name: margin + - name: properties type: object meta: - label: { de: "Abstand nach außen (Margin)", en: "Distance to the outside (Margin)" } + widget: tabs subFields: - - name: top - type: string + - name: margin + type: object meta: - widget: select - label: - de: Oben - en: Top - choices: - - { id: "", name: "Kein Abstand" } - - { id: "mt-xs", name: "Sehr kleiner Abstand" } - - { id: "mt-sm", name: "Kleiner Abstand" } - - { id: "mt-md", name: "Normal" } - - { id: "mt-lg", name: "Großer Abstand" } - - { id: "mt-xl", name: "Sehr großer Abstand" } - - name: right - type: string + label: { de: "Abstand nach außen (Margin)", en: "Distance to the outside (Margin)" } + subFields: + - name: top + type: string + meta: + widget: select + label: + de: Oben + en: Top + choices: + - { id: "", name: "Kein Abstand" } + - { id: "mt-xs", name: "Sehr kleiner Abstand" } + - { id: "mt-sm", name: "Kleiner Abstand" } + - { id: "mt-md", name: "Normal" } + - { id: "mt-lg", name: "Großer Abstand" } + - { id: "mt-xl", name: "Sehr großer Abstand" } + - name: right + type: string + meta: + widget: select + label: + de: Rechts + en: Right + choices: + - { id: "", name: "Kein Abstand" } + - { id: "mr-xs", name: "Sehr kleiner Abstand" } + - { id: "mr-sm", name: "Kleiner Abstand" } + - { id: "mr-md", name: "Normal" } + - { id: "mr-lg", name: "Großer Abstand" } + - { id: "mr-xl", name: "Sehr großer Abstand" } + - name: bottom + type: string + meta: + widget: select + label: + de: Unten + en: Bottom + choices: + - { id: "", name: "Kein Abstand" } + - { id: "mb-xs", name: "Sehr kleiner Abstand" } + - { id: "mb-sm", name: "Kleiner Abstand" } + - { id: "mb-md", name: "Normal" } + - { id: "mb-lg", name: "Großer Abstand" } + - { id: "mb-xl", name: "Sehr großer Abstand" } + - name: left + type: string + meta: + widget: select + label: + de: Links + en: Left + choices: + - { id: "", name: "Kein Abstand" } + - { id: "ml-xs", name: "Sehr kleiner Abstand" } + - { id: "ml-sm", name: "Kleiner Abstand" } + - { id: "ml-md", name: "Normal" } + - { id: "ml-lg", name: "Großer Abstand" } + - { id: "ml-xl", name: "Sehr großer Abstand" } + - name: padding + type: object meta: - widget: select - label: - de: Rechts - en: Right - choices: - - { id: "", name: "Kein Abstand" } - - { id: "mr-xs", name: "Sehr kleiner Abstand" } - - { id: "mr-sm", name: "Kleiner Abstand" } - - { id: "mr-md", name: "Normal" } - - { id: "mr-lg", name: "Großer Abstand" } - - { id: "mr-xl", name: "Sehr großer Abstand" } - - name: bottom - type: string - meta: - widget: select - label: - de: Unten - en: Bottom - choices: - - { id: "", name: "Kein Abstand" } - - { id: "mb-xs", name: "Sehr kleiner Abstand" } - - { id: "mb-sm", name: "Kleiner Abstand" } - - { id: "mb-md", name: "Normal" } - - { id: "mb-lg", name: "Großer Abstand" } - - { id: "mb-xl", name: "Sehr großer Abstand" } - - name: left - type: string - meta: - widget: select - label: - de: Links - en: Left - choices: - - { id: "", name: "Kein Abstand" } - - { id: "ml-xs", name: "Sehr kleiner Abstand" } - - { id: "ml-sm", name: "Kleiner Abstand" } - - { id: "ml-md", name: "Normal" } - - { id: "ml-lg", name: "Großer Abstand" } - - { id: "ml-xl", name: "Sehr großer Abstand" } - - name: padding - type: object - meta: - label: { de: "Abstand nach innen (Padding)", en: "Distance inside (Padding)" } - subFields: - - name: top - type: string - meta: - widget: select - label: - de: Oben - en: Top - choices: - - { id: "", name: "Kein Abstand" } - - { id: "pt-xs", name: "Sehr kleiner Abstand" } - - { id: "pt-sm", name: "Kleiner Abstand" } - - { id: "pt-md", name: "Normal" } - - { id: "pt-lg", name: "Großer Abstand" } - - { id: "pt-xl", name: "Sehr großer Abstand" } - - name: right - type: string - meta: - widget: select - label: - de: Rechts - en: Right - choices: - - { id: "", name: "Kein Abstand" } - - { id: "pr-xs", name: "Sehr kleiner Abstand" } - - { id: "pr-sm", name: "Kleiner Abstand" } - - { id: "pr-md", name: "Normal" } - - { id: "pr-lg", name: "Großer Abstand" } - - { id: "pr-xl", name: "Sehr großer Abstand" } - - name: bottom - type: string - meta: - widget: select - label: - de: Unten - en: Bottom - choices: - - { id: "", name: "Kein Abstand" } - - { id: "pb-xs", name: "Sehr kleiner Abstand" } - - { id: "pb-sm", name: "Kleiner Abstand" } - - { id: "pb-md", name: "Normal" } - - { id: "pb-lg", name: "Großer Abstand" } - - { id: "pb-xl", name: "Sehr großer Abstand" } - - name: left - type: string - meta: - widget: select - label: - de: Links - en: Left - choices: - - { id: "", name: "Kein Abstand" } - - { id: "pl-xs", name: "Sehr kleiner Abstand" } - - { id: "pl-sm", name: "Kleiner Abstand" } - - { id: "pl-md", name: "Normal" } - - { id: "pl-lg", name: "Großer Abstand" } - - { id: "pl-xl", name: "Sehr großer Abstand" } + label: { de: "Abstand nach innen (Padding)", en: "Distance inside (Padding)" } + subFields: + - name: top + type: string + meta: + widget: select + label: + de: Oben + en: Top + choices: + - { id: "", name: "Kein Abstand" } + - { id: "pt-xs", name: "Sehr kleiner Abstand" } + - { id: "pt-sm", name: "Kleiner Abstand" } + - { id: "pt-md", name: "Normal" } + - { id: "pt-lg", name: "Großer Abstand" } + - { id: "pt-xl", name: "Sehr großer Abstand" } + - name: right + type: string + meta: + widget: select + label: + de: Rechts + en: Right + choices: + - { id: "", name: "Kein Abstand" } + - { id: "pr-xs", name: "Sehr kleiner Abstand" } + - { id: "pr-sm", name: "Kleiner Abstand" } + - { id: "pr-md", name: "Normal" } + - { id: "pr-lg", name: "Großer Abstand" } + - { id: "pr-xl", name: "Sehr großer Abstand" } + - name: bottom + type: string + meta: + widget: select + label: + de: Unten + en: Bottom + choices: + - { id: "", name: "Kein Abstand" } + - { id: "pb-xs", name: "Sehr kleiner Abstand" } + - { id: "pb-sm", name: "Kleiner Abstand" } + - { id: "pb-md", name: "Normal" } + - { id: "pb-lg", name: "Großer Abstand" } + - { id: "pb-xl", name: "Sehr großer Abstand" } + - name: left + type: string + meta: + widget: select + label: + de: Links + en: Left + choices: + - { id: "", name: "Kein Abstand" } + - { id: "pl-xs", name: "Sehr kleiner Abstand" } + - { id: "pl-sm", name: "Kleiner Abstand" } + - { id: "pl-md", name: "Normal" } + - { id: "pl-lg", name: "Großer Abstand" } + - { id: "pl-xl", name: "Sehr großer Abstand" } - name: link type: object meta: diff --git a/api/collections/fields/_locale.yml b/api/collections/fields/_locale.yml index c7b6929..5b29f42 100644 --- a/api/collections/fields/_locale.yml +++ b/api/collections/fields/_locale.yml @@ -2,7 +2,7 @@ name: locale type: string meta: widget: select - label: { de: "Gebietsschema", en: "Locale" } + label: { de: "Sprache", en: "Language" } helperText: { de: "Definiert, in welcher Sprache das Menü verfügbar ist. Die Standard-Sprache ist 'de-DE'.", diff --git a/src/components/routes/Content.svelte b/src/components/routes/Content.svelte index 28fd12f..34afba8 100644 --- a/src/components/routes/Content.svelte +++ b/src/components/routes/Content.svelte @@ -54,6 +54,11 @@ } content = null } + + // Redirect to HOME if no content has been found. So the page 404 content will never shown. + if (!content) { + navigate("/") + } }) .finally(() => { loading = false @@ -79,6 +84,7 @@ {#if loading} {:else if content} + {#each content.blocks || [] as b}

{b.article.content.title}

{JSON.stringify(b)}