forked from cms/tibi-svelte-starter
Zuweisung von Artikeln zu Seiten möglich. Somit werden keine Content-Blocks mehr benötigt und alle Artikel können über die articles-Collection gepflegt udn zugewiesen werden.
This commit is contained in:
parent
05fe698af6
commit
ee7ed0db1f
@ -141,10 +141,10 @@ fields:
|
|||||||
helperText:
|
helperText:
|
||||||
de: "Sind mehr als ein Stichwort mit einer Seite verknüpft, führt die Priorität (z.B.: eine Zahl von 0..10..x) der gefundenen Seiten zu einer automatischen Vorauswahl aus den gefundenen Seiten."
|
de: "Sind mehr als ein Stichwort mit einer Seite verknüpft, führt die Priorität (z.B.: eine Zahl von 0..10..x) der gefundenen Seiten zu einer automatischen Vorauswahl aus den gefundenen Seiten."
|
||||||
en: "If more than one keyword is linked to a page, the priority (e.g. a number 0..10..x) of the pages found leads to an automatic preselection from the pages found."
|
en: "If more than one keyword is linked to a page, the priority (e.g. a number 0..10..x) of the pages found leads to an automatic preselection from the pages found."
|
||||||
- name: blocks
|
# - name: blocks
|
||||||
type: object[]
|
# type: object[]
|
||||||
meta:
|
# meta:
|
||||||
label: { de: "Artikel dieser Seite", en: "Page Articles" }
|
# label: { de: "Artikel dieser Seite", en: "Page Articles" }
|
||||||
collapse: { titleFieldName: "article.content.title" }
|
# collapse: { titleFieldName: "article.content.title" }
|
||||||
subFields:
|
# subFields:
|
||||||
- !include fields/_article.yml
|
# - !include fields/_article.yml
|
||||||
|
@ -58,7 +58,7 @@ subFields:
|
|||||||
choices:
|
choices:
|
||||||
endpoint: "content"
|
endpoint: "content"
|
||||||
mapping:
|
mapping:
|
||||||
id: "id"
|
id: "path"
|
||||||
name: "path"
|
name: "path"
|
||||||
params:
|
params:
|
||||||
sort: "path"
|
sort: "path"
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
import { navigate } from "svelte-routing"
|
import { navigate } from "svelte-routing"
|
||||||
|
|
||||||
import Image from "../widgets/Image.svelte"
|
import Image from "../widgets/Image.svelte"
|
||||||
|
import ArticlesList from "../widgets/ArticlesList.svelte"
|
||||||
|
// import Article from "../widgets/Article.svelte"
|
||||||
|
|
||||||
export let path: string
|
export let path: string
|
||||||
|
|
||||||
@ -13,7 +15,7 @@
|
|||||||
let connectedContentNotFound: boolean = false
|
let connectedContentNotFound: boolean = false
|
||||||
$: currentDomain = window.location.protocol + "//" + window.location.host
|
$: currentDomain = window.location.protocol + "//" + window.location.host
|
||||||
|
|
||||||
const load = (type?: string) => {
|
const loadContent = (type?: string) => {
|
||||||
// Set default API call filter
|
// Set default API call filter
|
||||||
let filter = {
|
let filter = {
|
||||||
locale: $currentLang,
|
locale: $currentLang,
|
||||||
@ -45,6 +47,7 @@
|
|||||||
if (type === "changedLanguage") {
|
if (type === "changedLanguage") {
|
||||||
let newPath = c.path + $location.search
|
let newPath = c.path + $location.search
|
||||||
window.history.pushState({}, document.getElementsByTagName("title")[0].innerHTML, newPath)
|
window.history.pushState({}, document.getElementsByTagName("title")[0].innerHTML, newPath)
|
||||||
|
path = newPath
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedContentNotFound = false
|
connectedContentNotFound = false
|
||||||
@ -69,11 +72,11 @@
|
|||||||
|
|
||||||
currentLang.subscribe(() => {
|
currentLang.subscribe(() => {
|
||||||
if (content) {
|
if (content) {
|
||||||
load("changedLanguage")
|
loadContent("changedLanguage")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$: if (path) load()
|
$: if (path) loadContent()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@ -86,11 +89,12 @@
|
|||||||
{#if loading}
|
{#if loading}
|
||||||
<!-- Loader -->
|
<!-- Loader -->
|
||||||
{:else if content}
|
{:else if content}
|
||||||
<!-- {JSON.stringify(content)} -->
|
<!--
|
||||||
{#each content.blocks || [] as b}
|
{#each content.blocks || [] as b}
|
||||||
<h1>{b.article.content.title}</h1>
|
|
||||||
{JSON.stringify(b)}
|
{JSON.stringify(b)}
|
||||||
{/each}
|
{/each}
|
||||||
|
-->
|
||||||
|
<ArticlesList path="{path}" />
|
||||||
{:else}
|
{:else}
|
||||||
<div class="page-404">
|
<div class="page-404">
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as animateScroll from "svelte-scrollto"
|
import * as animateScroll from "svelte-scrollto"
|
||||||
|
|
||||||
import { currentLang } from "../../store"
|
|
||||||
import { getArticles } from "../../api"
|
|
||||||
|
|
||||||
import GoogleMaps from "../widgets/GoogleMaps.svelte"
|
import GoogleMaps from "../widgets/GoogleMaps.svelte"
|
||||||
import ScrollTo from "../widgets/ScrollTo.svelte"
|
import ScrollTo from "../widgets/ScrollTo.svelte"
|
||||||
import ContactForm from "../widgets/ContactForm.svelte"
|
import ContactForm from "../widgets/ContactForm.svelte"
|
||||||
import GeneralMediaImage from "../widgets/GeneralMediaImage.svelte"
|
import GeneralMediaImage from "../widgets/GeneralMediaImage.svelte"
|
||||||
import Article from "../widgets/Article.svelte"
|
|
||||||
import ArticlesList from "../widgets/ArticlesList.svelte"
|
import ArticlesList from "../widgets/ArticlesList.svelte"
|
||||||
|
|
||||||
let expandedForm: string = "recipe"
|
let expandedForm: string = "recipe"
|
||||||
|
@ -4,11 +4,15 @@
|
|||||||
|
|
||||||
import TibiArticleMediaFile from "./TibiArticleMediaFile.svelte"
|
import TibiArticleMediaFile from "./TibiArticleMediaFile.svelte"
|
||||||
|
|
||||||
export let entry: CollectionEntry
|
export let entry: CollectionEntry = null
|
||||||
export let cssClass: string = ""
|
export let cssClass: string = ""
|
||||||
export let showDetails: boolean = false
|
export let showDetails: boolean = false
|
||||||
|
|
||||||
let article = entry.article
|
let article = null
|
||||||
|
if (entry) {
|
||||||
|
article = entry.article
|
||||||
|
}
|
||||||
|
|
||||||
let marginClasses: string = ""
|
let marginClasses: string = ""
|
||||||
let paddingClasses: string = ""
|
let paddingClasses: string = ""
|
||||||
let published: boolean = true
|
let published: boolean = true
|
||||||
@ -61,7 +65,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if article && published}
|
{#if article && published}
|
||||||
<article class="{cssClass} {article?.layout?.variant} {marginClasses} {paddingClasses}" transition:fade>
|
<article class="{cssClass} {article?.layout?.variant} {marginClasses} {paddingClasses}">
|
||||||
{#if article?.layout?.variant === "top"}
|
{#if article?.layout?.variant === "top"}
|
||||||
{#if article?.content?.types?.media?.files?.length}
|
{#if article?.content?.types?.media?.files?.length}
|
||||||
<TibiArticleMediaFile
|
<TibiArticleMediaFile
|
||||||
|
@ -4,17 +4,25 @@
|
|||||||
|
|
||||||
import Article from "../widgets/Article.svelte"
|
import Article from "../widgets/Article.svelte"
|
||||||
|
|
||||||
export let tag: string
|
export let tag: string = null
|
||||||
|
export let path: string = null
|
||||||
|
|
||||||
let articleEntries: CollectionEntry[] = []
|
let articleEntries: CollectionEntry[] = []
|
||||||
|
|
||||||
$: if ($currentLang) {
|
$: if ($currentLang) {
|
||||||
getArticles("articles", {
|
let filter = {
|
||||||
filter: {
|
"article.general.locale": $currentLang,
|
||||||
"article.general.locale": $currentLang,
|
}
|
||||||
"article.general.tags": { $in: [tag] },
|
|
||||||
},
|
if (tag) {
|
||||||
}).then((response) => {
|
filter["article.general.tags"] = { $in: [tag] }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path) {
|
||||||
|
filter["article.general.pages"] = { $in: [path] }
|
||||||
|
}
|
||||||
|
|
||||||
|
getArticles("articles", { filter }).then((response) => {
|
||||||
articleEntries = response
|
articleEntries = response
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
article,
|
article,
|
||||||
.article {
|
.article {
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
border: 1px dashed @on-background;
|
// border: 1px dashed @on-background;
|
||||||
|
|
||||||
& ~ article,
|
& ~ article,
|
||||||
& ~ .article {
|
& ~ .article {
|
||||||
|
4
types/global.d.ts
vendored
4
types/global.d.ts
vendored
@ -27,7 +27,7 @@ interface Content {
|
|||||||
tags?: string[]
|
tags?: string[]
|
||||||
path: string
|
path: string
|
||||||
name: string
|
name: string
|
||||||
blocks: ContentBlock[]
|
blocks?: ContentBlock[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GeneralInfo {
|
interface GeneralInfo {
|
||||||
@ -68,7 +68,7 @@ interface GeneralInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface TibiArticle {
|
interface TibiArticle {
|
||||||
id: string
|
id?: string
|
||||||
article: {
|
article: {
|
||||||
general: {
|
general: {
|
||||||
public: boolean
|
public: boolean
|
||||||
|
Loading…
Reference in New Issue
Block a user