#routepath helper

2 messages · Page 1 of 1 (latest)

scarlet cliffBOT
#

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

#

Astro uses standard HTML <a> elements to navigate between routes. There is no framework-specific <Link> component provided. To create a link to another page, you would use the standard HTML <a> element with the href attribute set to the desired path.

In your case, if you want to link to a page located at src/pages/cities/[city]/dogs/[...slug].astro, you would construct the href attribute with the appropriate city and slug values. Here's an example:

<a href={`/cities/${city}/dogs/${slug}`}>Go to another page</a>

In this example, city and slug would be variables that you've defined in your Astro component's frontmatter script.

Please note that Astro uses file-based routing to generate your build URLs based on the file layout of your project src/pages/ directory. When you add a file to the src/pages/ directory, a new route is automatically created for you.

For more information on routing in Astro, you can refer to the Astro documentation on routing (https://docs.astro.build/en/core-concepts/routing/).

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