#Astro + Storyblok; Issue with Blog List on More Than One Page.

3 messages · Page 1 of 1 (latest)

left blade
#

Hi everyone,

I am having an issue with links from my homepage with three featured posts (the three latest) loading the correct URL; Perhaps you can help.

The links to the individual blog posts work just fine from https://rfportfolioastro.netlify.app/blog/, however, on my homepage, they do not add the "/blog" to the slug, therefore resulting in a 404 Error. I cannot figure out what to do to fix this.

Thanks in advance.

GitHub

My on-going portfolio and blog rebuild using Astro, React, Tailwind, and Storyblok - GitHub - ryanfurrer/rf-astro-portfolio-and-blog: My on-going portfolio and blog rebuild using Astro, React, Tail...

hasty nimbusBOT
#

Hi @left blade. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, it seems like the issue might be related to how you're generating the URLs for your blog posts on your homepage.

In Astro, when you're generating links to your blog posts, you need to ensure that the correct path is included in the URL. For example, if your blog posts are located in a blog directory, you need to include /blog/ in the URL.

Here's an example of how you might generate a list of blog posts with correct URLs, based on the information in the extracts:

<ul>
  {allPosts.map((post) => (
    <li>
      <a href={`/blog/${post.slug}`}>{post.frontmatter.title}</a>
    </li>
  ))}
</ul>

In this example, /blog/ is included in the URL, ensuring that the link will lead to the correct blog post.

Please check your homepage code and ensure that you're including /blog/ in the URLs for your blog posts. If you're still having issues, you might want to check the Astro documentation (https://docs.astro.build) or ask for help in the Astro GitHub repository (https://github.com/withastro/astro/issues).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: