Skip to content

Links

You can use Command + K Control + K Command + K to wrap selected text in an empty markdown link, and pasting a valid URL over selected text will wrap it in a link to that URL. Holding Option Alt Option while clicking a URL will open it in your browser.

You can use the Content Finder to search across all the content items in your collections and insert a markdown link to it. This is especially handy when you’re mid-flow and want to cross-reference another piece of content without leaving the editor.

You can open the Content Finder with Command + Shift + K Control + Shift + K Command + Shift + K , or via the Command Palette.

The Content Finder dialog showing a search field and a list of content items to link to

Because Enter Enter Enter opens the item for editing, you must use Command + Enter Control + Enter Command + Enter to insert a markdown link into the current document. The title will be used as the link text.

By default, links inserted this way will use a relative path from the current file to the target file.

[My Blog Post](../blog/my-blog-post.md)

This is often not what you want, so each collection can have a URL pattern for these links, set in Project Settings. For example, if your blog collection serves posts at /writing/mypost you can set the URL pattern to /writing/{slug}, which will cause links to blog posts to look like this instead:

[My Blog Post](/writing/my-blog-post)

The {slug} placeholder is the item’s slug frontmatter if it has one. Otherwise it’s the id Astro gives the entry: its path in the collection without the extension, lowercased and slugified, with a trailing /index dropped. So 2024/My Post.md gives 2024/my-post, and 2024/my-post/index.md gives the same.