Minor Changes
-
#8696
2167ffd72
Thanks @matthewp! - Support adding integrations dynamicallyAstro integrations can now themselves dynamically add and configure additional integrations during set-up. This makes it possible for integration authors to bundle integrations more intelligently for their users.
In the following example, a custom integration checks whether
@astrojs/sitemap
is already configured. If not, the integration adds Astro’s sitemap integration, passing any desired configuration options:import sitemap from '@astrojs/sitemap'; import type { AstroIntegration } from 'astro'; const MyIntegration = (): AstroIntegration => { return { name: 'my-integration', 'astro:config:setup': ({ config, updateConfig }) => { // Look for sitemap in user-configured integrations. const userSitemap = config.integrations.find( ({ name }) => name === '@astrojs/sitemap' ); if (!userSitemap) { // If sitemap wasn’t found, add it. updateConfig({ integrations: [sitemap({ /* opts */ }], }); } }, }; };
-
#8696
2167ffd72
Thanks @matthewp! - View transitions can now be triggered from JavaScript!Import the client-side router from "astro:transitions/client" and enjoy your new remote control for navigation:
import { navigate } from 'astro:transitions/client'; // Navigate to the selected option automatically. document.querySelector('select').onchange = (ev) => { let href = ev.target.value; navigate(href); };
-
#8696
2167ffd72
Thanks @matthewp! - Route Announcer in<ViewTransitions />
The View Transitions router now does route announcement. When transitioning between pages with a traditional MPA approach, assistive technologies will announce the page title when the page finishes loading. This does not automatically happen during client-side routing, so visitors relying on these technologies to announce routes are not aware when a page has changed.
The view transitions route announcer runs after the
astro:page-load
event, looking for the page<title>
to announce. If one cannot be found, the announcer falls back to the first<h1>
it finds, or otherwise announces the pathname. We recommend you always include a<title>
in each page for accessibility.See the View Transitions docs for more on how accessibility is handled.
Patch Changes
-
#8647
408b50c5e
Thanks @lilnasy! - Fixed an issue where configured redirects with dynamic routes did not work in dev mode. -
#8696
2167ffd72
Thanks @matthewp! - Fix logLevel passed to Vite build -
#8696
2167ffd72
Thanks @matthewp! - Fix NoImageMetadata image path error message -
#8670
e797b6816
Thanks @MichailiK! - Fix asset optimization failing when outDir is outside the project directory -
#8684
824dd4670
Thanks @matthewp! - Support content collections with % in filename -
#8648
cfd895d87
Thanks @lilnasy! - Fixed an issue where a response with status code 404 led to an endless loop of implicit rerouting in dev mode.