Start loading posts from Wordpress

This commit is contained in:
Lewis Dale 2023-02-16 08:34:36 +00:00
parent 2430b9f3eb
commit 09ac787260
2 changed files with 13 additions and 9 deletions

View File

@ -1,7 +1,5 @@
const wordpressPassword = process.env.WORDPRESS_PASSWORD; const wordpressPassword = process.env.WORDPRESS_PASSWORD;
module.exports = async () => { module.exports = async () => {
const response = await fetch("https://lewisdale.dev/wp-json/wp/v2/posts?per_page=100", { const response = await fetch("https://lewisdale.dev/wp-json/wp/v2/posts?per_page=100", {
headers: { headers: {
@ -9,9 +7,8 @@ module.exports = async () => {
} }
}); });
const responses = await response.json(); const posts = await response.json();
console.log(JSON.stringify(responses[0], null, 2)); console.log(posts.map(post => Buffer.from(post.title.rendered).toString("utf-8")));
return posts;
return responses;
}; };

View File

@ -1,4 +1,11 @@
article img { article {
img {
margin-inline-start: auto; margin-inline-start: auto;
margin-inline-end: auto; margin-inline-end: auto;
}
ul, ol {
list-style: initial;
padding: 0 var(--space-size-m);
}
} }