Files
pulse/content/integrations/astro.mdx
Usman Baig 627613dc13 fix: code blocks rendering + consistent styling with ciphera-website /learn
- Convert MDX CodeBlock components to standard markdown code fences
- Add rehype-mdx-code-props to pass filename meta to code components
- Custom pre/code MDX components map fences to CodeBlock
- Add brand color badges (product + category) matching /learn layout
- Match prose styling: orange inline code, orange links, white strong
- Remove brand color background glow (not in /learn)
2026-03-29 01:01:56 +01:00

51 lines
1.1 KiB
Plaintext

---
title: "Astro"
description: "Integrate Pulse analytics with Astro. Add the script to your base layout for all pages."
category: "framework"
brandColor: "#BC52EE"
officialUrl: "https://docs.astro.build"
relatedIds: ["svelte", "hugo", "eleventy"]
date: "2026-03-28"
---
Add the Pulse script to your base layout so it's included on every page of your Astro site.
---
## Add to your base layout
Place the Pulse script in the `<head>` of your shared layout component.
```html filename="src/layouts/BaseLayout.astro"
---
interface Props {
title: string
}
const { title } = Astro.props
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script
defer
data-domain="your-site.com"
src="https://pulse.ciphera.net/script.js"
></script>
<title>{title}</title>
</head>
<body>
<slot />
</body>
</html>
```
If you're using Astro's View Transitions, the script will persist across navigations by default since it's in the `<head>`.
For more details, see the [Astro scripts docs](https://docs.astro.build/en/guides/client-side-scripts/).