forked from cms/tibi-svelte-starter
ArticleDetails page vorbereitet.
This commit is contained in:
parent
ddd236af06
commit
60bd5d21c9
@ -98,7 +98,6 @@ subFields:
|
|||||||
label:
|
label:
|
||||||
de: Inhalt
|
de: Inhalt
|
||||||
en: Content
|
en: Content
|
||||||
css:
|
|
||||||
subFields:
|
subFields:
|
||||||
- name: slug
|
- name: slug
|
||||||
type: string
|
type: string
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import Home from "./routes/Home.svelte"
|
import Home from "./routes/Home.svelte"
|
||||||
import Content from "./routes/Content.svelte"
|
import Content from "./routes/Content.svelte"
|
||||||
|
import ArticleDetails from "./routes/ArticleDetails.svelte"
|
||||||
|
|
||||||
import Header from "./widgets/Header.svelte"
|
import Header from "./widgets/Header.svelte"
|
||||||
import Footer from "./widgets/Footer.svelte"
|
import Footer from "./widgets/Footer.svelte"
|
||||||
@ -65,7 +66,8 @@
|
|||||||
<Home />
|
<Home />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/*path" let:params>
|
<Route path="/*path" let:params>
|
||||||
<Content path="{params.path}" />
|
<!-- <Content path="{params.path}" /> -->
|
||||||
|
<ArticleDetails path="{params.path}" />
|
||||||
</Route>
|
</Route>
|
||||||
</Router>
|
</Router>
|
||||||
|
|
||||||
|
@ -2,15 +2,23 @@
|
|||||||
import { currentLang } from "../../store"
|
import { currentLang } from "../../store"
|
||||||
import { getArticles } from "../../api"
|
import { getArticles } from "../../api"
|
||||||
|
|
||||||
// import Article from "../widgets/Article.svelte"
|
import Article from "../widgets/Article.svelte"
|
||||||
|
|
||||||
|
export let path: string
|
||||||
|
|
||||||
|
let articleEntries: CollectionEntry[] = []
|
||||||
|
|
||||||
$: if ($currentLang) {
|
$: if ($currentLang) {
|
||||||
|
let urlParts = path.split("/")
|
||||||
|
let slug = urlParts[urlParts.length - 1]
|
||||||
|
|
||||||
getArticles("articles", {
|
getArticles("articles", {
|
||||||
filter: {
|
filter: {
|
||||||
"article.general.locale": $currentLang,
|
"article.general.locale": $currentLang,
|
||||||
|
"article.content.slug": slug,
|
||||||
},
|
},
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
console.log(response)
|
articleEntries = response
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -18,7 +26,9 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h1>ARTICLE DETAILS</h1>
|
{#each articleEntries || [] as entry}
|
||||||
|
<Article entry="{entry}" />
|
||||||
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user