Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

better docs

Blue Mousefad936e026d0
diff --git a/docs/app/layout.tsx b/docs/app/layout.tsx
index 5ee7be7b4..0947a5ae3 100644
--- a/docs/app/layout.tsx
+++ b/docs/app/layout.tsx
@@ -1,5 +1,6 @@
import { RootProvider } from 'fumadocs-ui/provider/next';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
+import { GithubInfo } from 'fumadocs-ui/components/github-info';
import type { ReactNode } from 'react';
import { source } from '@/lib/source';
import Script from 'next/script';
@@ -55,14 +56,14 @@ export default function RootLayout({ children }: { children: ReactNode }) {
}}
links={[
{
- text: 'Swetrix',
- url: 'https://swetrix.com',
- external: true,
- },
- {
- text: 'GitHub',
- url: 'https://github.com/Swetrix',
- external: true,
+ type: 'custom',
+ children: (
+ <GithubInfo
+ owner="Swetrix"
+ repo="swetrix"
+ className="lg:-mx-2"
+ />
+ ),
},
]}
>
diff --git a/docs/components/Icon.tsx b/docs/components/Icon.tsx
new file mode 100644
index 000000000..14c09e8b4
--- /dev/null
+++ b/docs/components/Icon.tsx
@@ -0,0 +1,10 @@
+'use client';
+
+import * as PhosphorIcons from '@phosphor-icons/react';
+import { createElement } from 'react';
+
+export function Icon({ name }: { name: string }) {
+ const IconComponent = PhosphorIcons[name as keyof typeof PhosphorIcons] as any;
+ if (!IconComponent) return null;
+ return createElement(IconComponent);
+}
diff --git a/docs/content/docs/add-script.mdx b/docs/content/docs/add-script.mdx
index bd664a4c4..bcbaf2b1c 100644
--- a/docs/content/docs/add-script.mdx
+++ b/docs/content/docs/add-script.mdx
@@ -1,6 +1,7 @@
---
title: Add tracking script to your website
slug: /install-script
+icon: Code
---
diff --git a/docs/content/docs/error-tracking.mdx b/docs/content/docs/error-tracking.mdx
index a0bb4acb7..c115d6a70 100644
--- a/docs/content/docs/error-tracking.mdx
+++ b/docs/content/docs/error-tracking.mdx
@@ -1,6 +1,7 @@
---
title: Error tracking
slug: /error-tracking
+icon: Bug
---
As well as providing you with regular data insights such as traffic or site speed, Swetrix also offers client-side error tracking.
diff --git a/docs/content/docs/introduction.mdx b/docs/content/docs/introduction.mdx
index 1d01cca3e..2883bd6a2 100644
--- a/docs/content/docs/introduction.mdx
+++ b/docs/content/docs/introduction.mdx
@@ -2,6 +2,7 @@
title: Welcome to Swetrix
description: Open-source, privacy-first web analytics for modern teams
slug: /
+icon: RocketLaunch
---
Swetrix is an open-source, lightweight, and privacy-focused web analytics platform. Understand your website traffic, monitor performance, track errors, and make data-driven decisions — all without compromising your users' privacy.
diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json
index 84d322079..4541740c9 100644
--- a/docs/content/docs/meta.json
+++ b/docs/content/docs/meta.json
@@ -1,7 +1,7 @@
{
"title": "Docs",
"pages": [
- "---Get Started---",
+ "---[RocketLaunch]Get Started---",
"introduction",
"add-script",
"script-reference",
diff --git a/docs/content/docs/script-reference.mdx b/docs/content/docs/script-reference.mdx
index 0610299b2..0054d5f59 100644
--- a/docs/content/docs/script-reference.mdx
+++ b/docs/content/docs/script-reference.mdx
@@ -1,6 +1,7 @@
---
title: Tracking script reference
slug: /swetrix-js-reference
+icon: FileCode
---
diff --git a/docs/content/docs/troubleshooting.mdx b/docs/content/docs/troubleshooting.mdx
index 59b64eb59..17caa6eb3 100644
--- a/docs/content/docs/troubleshooting.mdx
+++ b/docs/content/docs/troubleshooting.mdx
@@ -1,6 +1,7 @@
---
title: Troubleshooting
slug: /troubleshooting
+icon: Wrench
---
diff --git a/docs/lib/source.ts b/docs/lib/source.ts
index 9c866fd95..599148fe4 100644
--- a/docs/lib/source.ts
+++ b/docs/lib/source.ts
@@ -1,5 +1,7 @@
import { docs } from 'fumadocs-mdx:collections/server';
import { loader } from 'fumadocs-core/source';
+import { createElement } from 'react';
+import { Icon } from '@/components/Icon';
const SLUG_MAP: Record<string, string[]> = {
'introduction': [],
@@ -67,6 +69,12 @@ const SLUG_MAP: Record<string, string[]> = {
export const source = loader({
baseUrl: '/',
source: docs.toFumadocsSource(),
+ icon(iconString) {
+ if (iconString) {
+ return createElement(Icon, { name: iconString });
+ }
+ return undefined;
+ },
slugs(file) {
const p = file.path
.replace(/\.(mdx|md)$/, '')