neue Komponente für Artikellisten. Möglichkeit, Artikel Seiten zuzuweisen.
This commit is contained in:
@@ -66,8 +66,7 @@
|
||||
<Home />
|
||||
</Route>
|
||||
<Route path="/*path" let:params>
|
||||
<!-- <Content path="{params.path}" /> -->
|
||||
<ArticleDetails path="{params.path}" />
|
||||
<Content path="{params.path}" />
|
||||
</Route>
|
||||
</Router>
|
||||
|
||||
|
||||
@@ -9,28 +9,16 @@
|
||||
import ContactForm from "../widgets/ContactForm.svelte"
|
||||
import GeneralMediaImage from "../widgets/GeneralMediaImage.svelte"
|
||||
import Article from "../widgets/Article.svelte"
|
||||
import ArticlesList from "../widgets/ArticlesList.svelte"
|
||||
|
||||
let expandedForm: string = "recipe"
|
||||
let articleEntries: CollectionEntry[] = []
|
||||
|
||||
$: if ($currentLang) {
|
||||
getArticles("articles", {
|
||||
filter: {
|
||||
"article.general.locale": $currentLang,
|
||||
},
|
||||
}).then((response) => {
|
||||
articleEntries = response
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<section class="contact">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{#each articleEntries || [] as entry}
|
||||
<Article entry="{entry}" />
|
||||
{/each}
|
||||
<ArticlesList tag="home" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
25
src/components/widgets/ArticlesList.svelte
Normal file
25
src/components/widgets/ArticlesList.svelte
Normal file
@@ -0,0 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { currentLang } from "../../store"
|
||||
import { getArticles } from "../../api"
|
||||
|
||||
import Article from "../widgets/Article.svelte"
|
||||
|
||||
export let tag: string
|
||||
|
||||
let articleEntries: CollectionEntry[] = []
|
||||
|
||||
$: if ($currentLang) {
|
||||
getArticles("articles", {
|
||||
filter: {
|
||||
"article.general.locale": $currentLang,
|
||||
"article.general.tags": { $in: [tag] },
|
||||
},
|
||||
}).then((response) => {
|
||||
articleEntries = response
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each articleEntries || [] as entry}
|
||||
<Article entry="{entry}" />
|
||||
{/each}
|
||||
Reference in New Issue
Block a user