#Get all URLs in-code

13 messages · Page 1 of 1 (latest)

light tulip
#

Is there a good way in code to get a list of all the (public) URLs in code, e.g. if I want to list them in a JSX component

#

I think I can use astro.glob here and just list all the files in /pages

#

Is that a good way?

untold oasis
#

What do you mean by all URLs

light tulip
#

Literally - all the public, published pages in an astro site

untold oasis
#

Ahh I see I thought you meant scraping a page, do you want every page or just markdown pages?

light tulip
#

That's a good question - probably every page

#

Haven't decided if every page will be markdown yet

#

Would it make it easier?

untold oasis
#

Yes if your markdown is also in your /src/pages dir

#

When using Astro.glob() for markdown you can access a url property that is the rendered pathname for the file

light tulip
#

Ah - that's good to know