0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/.changeset/tricky-rabbits-count.md
Bjorn Lu 5eba34fcc6
Remove deprecated APIs (#5707)
* Remove deprecated Astro globals

* Remove deprecated hook param

* Fix test

* Add changeset

* Add TODO
2023-01-03 14:06:07 -05:00

844 B

astro
major

Remove deprecated Astro global APIs, including Astro.resolve, Astro.fetchContent, and Astro.canonicalURL.

Astro.resolve

You can resolve asset paths using import instead. For example:

---
import 'style.css'
import imageUrl from './image.png'
---

<img src={imageUrl} />

See the v0.25 migration guide for more information.

Astro.fetchContent

Use Astro.glob instead to fetch markdown files, or migrate to the Content Collections feature.

let allPosts = await Astro.glob('./posts/*.md');

Astro.canonicalURL

Use Astro.url instead to construct the canonical URL.

const canonicalURL = new URL(Astro.url.pathname, Astro.site);