1

How to access the markdown files stored in the second repository in the Astro framework.

I am working on a website that is built using the Astro framework. Below is the function glob which returns an array of posts that are live at .src/pages/post/*.md . I want to know, how I can view the posts written in another public repository stored in .md file.

const posts = await Astro.glob('../pages/post/*.md'); // returns an array of posts that live at ./src/pages/post/*.md
<div>
{posts.slice(0, 3).map((post) => (
  <article>
    <h2>{post.frontmatter.title}</h2>
    <p>{post.frontmatter.description}</p>
    <a href={post.url}>Read more</a>
  </article>
))}
</div>
user16217248
  • 3,119
  • 19
  • 19
  • 37
Anurag Verma
  • 121
  • 7

0 Answers0