Skip to content

Upgrade to Astro 7#3243

Open
borland wants to merge 2 commits into
mainfrom
orion/astro7
Open

Upgrade to Astro 7#3243
borland wants to merge 2 commits into
mainfrom
orion/astro7

Conversation

@borland

@borland borland commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Why: Astro 7 is faster than prior versions (The github actions build looks like it takes 9 minutes now, instead of 11+), and it is good to keep on top of dependency updates

Claude made the changes in this PR, and wrote the content below the line

I verified the output using pnpm dev and pnpm preview and as far as I can see, everything looks as it should.


What

Upgrades the docs site from Astro 6 to Astro 7 (astro@^7.0.9, @astrojs/mdx@^7.0.3) and fixes the breaking changes the upgrade surfaced. pnpm build completes cleanly (2695 pages, no warnings).

Changes

  • Header.astro — build failure fix. Astro 7 hands non-inline <script> tags to Vite for bundling, which cannot resolve the /docs/js/modules/theme-switcher.js public asset and failed the build with UNRESOLVED_IMPORT. Marked the script is:inline so Astro emits it verbatim and the browser resolves it at runtime — consistent with how the rest of the site references its public JS.

  • astro.config.mjs — deprecation migration. markdown.remarkPlugins is deprecated in Astro 7. Moved the remark plugins into markdown.processor: unified({ remarkPlugins }) from @astrojs/markdown-remark, and added that package as a direct dependency (it's now imported by the config; previously only transitive).

  • astro.config.mjs — config cleanup. Hoisted trailingSlash: 'never' to the top level, where it's actually honored (it was previously nested under markdown and silently ignored), and removed the dead extendDefaultPlugins option (a no-op since Astro 2).

Testing

pnpm build — passes, exit code 0, 2695 pages built, no deprecation or config warnings.

@team-marketing-branch-protections

Copy link
Copy Markdown

Pull request environment is available at https://stoctodocspr3243.z22.web.core.windows.net.

You can view the ephemeral environment status in Octopus Deploy.

This environment will be automatically deprovisioned when the pull request is closed, or after 7 days of inactivity.

@enf0rc3

enf0rc3 commented Jul 15, 2026

Copy link
Copy Markdown

Heads up on the Astro 6→7 upgrade: v7 changes the default compressHTML to JSX-style whitespace stripping, which removes whitespace between inline elements in .astro templates (our .md/.mdx content is unaffected).

I've spotted the difference in the breadcrumbs — the crumbs tighten up around the chevron separators since .site-breadcrumbs li is display: inline and relied on source whitespace for spacing.

It's site-wide as breadcrumbs render on every docs page, and the top nav is likely affected too.

Screenshots below — if the spacing isn't acceptable we can set compressHTML: true to restore the v6 behaviour.

image

More visible when swapping between tabs:

Bumps astro to ^7.0.9 and @astrojs/mdx to ^7.0.3, and resolves the
breaking changes surfaced by the upgrade:

- Header.astro: mark the theme-switcher <script> as `is:inline`. Astro 7
  hands non-inline scripts to Vite for bundling, which cannot resolve the
  `/docs/js/modules/theme-switcher.js` public asset and failed the build.
  Inlining emits it verbatim so the browser resolves it at runtime.

- astro.config.mjs: move remark plugins from the deprecated
  `markdown.remarkPlugins` into `markdown.processor: unified({ ... })`
  from @astrojs/markdown-remark (added as a direct dependency since it is
  now imported by the config). `trailingSlash` was not honored in its location, so it was removed, and drop the dead `extendDefaultPlugins`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@borland

borland commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @enf0rc3. I've updated the astro config to restore the v6 behaviour. If you refresh the ephemeral environment at https://stoctodocspr3243.z22.web.core.windows.net/docs/installation/requirements you can see it now matches the original

@steve-fenton-octopus steve-fenton-octopus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on the ephemeral environment. Looks good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants