Sure, when you fetch a single article from the slug, like this: dev.to/api/articles/nunogois/hello... - You'll see that the object it returns also includes this body_html property.
I believe in Astro you can then use set:html={body_html} in the element you wish to add the HTML. Let me know how it works and feel free to share the final result afterwards! I also want to try out Astro soon :)
I am passionate about creation, be it code or written. I believe that knowledge should be sharee. If we all gave a little bit of our time to helping the each other, the world would be a better place.
From my testing, I have found this:
This endpoint: https://dev.to/api/articles?username=psypher1 gets my articles but without the body_html
That for some reason is only on the specific paths when you know the path you're trying to get, which presents issues with the way Astro fetches things (needs to know all the paths).... I would need an endpoint that exposes all the post information
I am passionate about creation, be it code or written. I believe that knowledge should be sharee. If we all gave a little bit of our time to helping the each other, the world would be a better place.
Hmm, if that's the case I guess you can always fetch everything at once (loop through the articles and fetch their respective information) - That way you would end up with the complete dataset at the start/build time.
You can also check the API docs - Maybe there's a solution for your specific use case where the article info is expanded.
Like I said I'm not familiar with Astro yet, but it feels like it should have a solution for this specific use-case. These resources might help:
I am passionate about creation, be it code or written. I believe that knowledge should be sharee. If we all gave a little bit of our time to helping the each other, the world would be a better place.
I am passionate about creation, be it code or written. I believe that knowledge should be sharee. If we all gave a little bit of our time to helping the each other, the world would be a better place.
I am passionate about creation, be it code or written. I believe that knowledge should be sharee. If we all gave a little bit of our time to helping the each other, the world would be a better place.
Sure, when you fetch a single article from the slug, like this: dev.to/api/articles/nunogois/hello... - You'll see that the object it returns also includes this
body_html
property.I believe in Astro you can then use
set:html={body_html}
in the element you wish to add the HTML. Let me know how it works and feel free to share the final result afterwards! I also want to try out Astro soon :)The specific endpoint, I see...
From my testing, I have found this:
This endpoint:
https://dev.to/api/articles?username=psypher1
gets my articles but without thebody_html
That for some reason is only on the specific paths when you know the path you're trying to get, which presents issues with the way Astro fetches things (needs to know all the paths).... I would need an endpoint that exposes all the post information
Also, looking deeper at your code, the key part is
page.params.slug
I'll work on reverse engineering that for my
getStaticPaths
Hmm, if that's the case I guess you can always fetch everything at once (loop through the articles and fetch their respective information) - That way you would end up with the complete dataset at the start/build time.
You can also check the API docs - Maybe there's a solution for your specific use case where the article info is expanded.
Like I said I'm not familiar with Astro yet, but it feels like it should have a solution for this specific use-case. These resources might help:
Thank you for this...
It's not the dynamic pages that are the issue - that I can do...
The url I need is one with all posts with all the content... I'll have a dig around the docs
Hey @nunogois
I got it! The docs were the key... for Astro I have to use this one
https://dev.to/api/articles/me/published
with an API keyI can write my article now
Great that you got it, thanks for sharing! 🙂
Thank you for the help