#absolute links

3 messages · Page 1 of 1 (latest)

ember crescent
#

Is there a way to make Astro use the full server path for anchor links?

empty sinewBOT
#

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

#

Yes, you can use the full server path for anchor links in Astro. You can do this by using standard HTML <a> elements with the href attribute set to the desired path. For example:

<a href="/about/">About</a>

This will create a link to the /about/ page on your site. Astro uses standard HTML <a> elements to navigate between pages, also known as routes, with traditional page refreshes.

You can also create a custom <Link> component in Astro and use it just like any other component. Here's an example of how you can do this:

---const { to } = Astro.props---<a href={to}><slot /></a>

In this example, to is a prop that you can pass to the <Link> component to specify the path for the link.

For more information, you can refer to the Astro documentation (https://docs.astro.build/en/tutorial/2-pages/1/).

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