Skip to content
/ docs Public
forked from withastro/docs

Commit

Permalink
i18n(fr): Update guides/cms/statamic from withastro#7119
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Bonnet <[email protected]>
  • Loading branch information
thomasbnt committed Jun 25, 2024
1 parent 17ec50d commit fb1136a
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions src/content/docs/fr/guides/cms/statamic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,45 @@ Par exemple, pour afficher une liste de titres et leur contenu à partir d'une [

```astro title="src/pages/index.astro
---
const res = await fetch("https://[YOUR-SITE]/graphql/",
{
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({
query: `
posts: entries(collection: "posts", sort: "date desc") {
data {
title
... on Entry_Posts_Post {
const graphqlQuery = {
query: `
query Entries($page: Int, $locale: String) {
entries(
collection: "posts"
sort: "date asc"
limit: 20
page: $page
filter: { locale: $locale }
) {
current_page
has_more_pages
data {
title
... on Entry_Posts_Post {
content
}
}
}
`
}),
});
const entries = await res.json()
}
}
`,
variables: {
page: page,
locale: locale,
},
};
const res = await fetch("https://[YOUR-SITE]/graphql", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(graphqlQuery),
})
const { data } = await res.json();
const entries = data?.entries;
---
<h1>Astro + Statamic 🚀</h1>
{
entries.data.posts.data.map((post) => (
entries.data.map((post) => (
<h2 set:html={post.title} />
<p set:html={post.content} />
))
Expand Down

0 comments on commit fb1136a

Please sign in to comment.