You're correct that Astro.glob() does not support dynamic variables or string interpolation due to a limitation of Vite’s import.meta.glob() function, which only supports static string literals. This is not a bug in Astro, but a limitation of the underlying technology it uses for this feature (source (https://docs.astro.build/en/guides/troubleshooting/#astroglob---no-matches-found)).
However, you can use a workaround to import a larger set of files that includes all the files you need using Astro.glob(), and then filter them based on your requirements. Here's an example:
---
const { category } = Astro.props;
const allPosts = await Astro.glob('../content/**/*.md');
const categoryPosts = allPosts.filter(post => post.file.includes(`../content/${category}/`));
---
In this example, Astro.glob() is used to import all markdown files from the content directory and its subdirectories. Then, the filter() method is used to select only the posts that belong to the specified category.
However, a more efficient way to handle this would be to use Astro's getCollection() API, which is designed for loading multiple files from content collections. This would allow you to directly query the collection corresponding to the category you're interested in, without having to load and filter all posts. Here's how you could do it:
---
import { getCollection } from "astro:content";
const { category } = Astro.props;
const categoryPosts = await getCollection(category);
---