Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ Make sure to deploy the output of `npm run build`
│ └── server/ # Server-side code
```

### Analytics (Umami)

The docs app supports Umami analytics via a Vite environment variable.

Set this in your deployment environment (for example, Vercel):

```bash
VITE_UMAMI_WEBSITE_ID=<your-umami-website-id>
```

When the variable is set, the app injects:

```html
<script defer src="https://umami.lloydrichards.dev/script.js" data-website-id="..." />
```

## Styling

This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer.
Expand Down
5 changes: 5 additions & 0 deletions apps/docs/app/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_UMAMI_WEBSITE_ID?: string;
}
9 changes: 9 additions & 0 deletions apps/docs/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const themeScript = `
})();
`;

const umamiWebsiteId = import.meta.env.VITE_UMAMI_WEBSITE_ID;

export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
Expand All @@ -55,6 +57,13 @@ export function Layout({ children }: { children: React.ReactNode }) {
<meta name="viewport" content="width=device-width, initial-scale=1" />
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: theme script must be inline to prevent FOUC */}
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
{umamiWebsiteId ? (
<script
defer
src="https://umami.lloydrichards.dev/script.js"
data-website-id={umamiWebsiteId}
/>
) : null}
<Meta />
<Links />
</head>
Expand Down
Loading