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!

added sitemap.xml

Blue Mouse5f200d5c0466
diff --git a/app/entry.server.tsx b/app/entry.server.tsx
index 8ce3a3d43..59d47802e 100644
--- a/app/entry.server.tsx
+++ b/app/entry.server.tsx
@@ -8,18 +8,30 @@ import { Response } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import isbot from 'isbot'
import { renderToPipeableStream } from 'react-dom/server'
+import { createSitemapGenerator } from 'remix-sitemap'
import i18next from './i18next.server'
import i18n, { detectLanguage } from './i18n'
const ABORT_DELAY = 5_000
+// TODO: Exclude /project/* endpoints from sitemap
+const { isSitemapUrl, sitemap } = createSitemapGenerator({
+ siteUrl: 'https://swetrix.com',
+ autoLastmod: false,
+ priority: 0.8
+})
+
export default async function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext,
) {
+ if (isSitemapUrl(request)) {
+ return await sitemap(request, remixContext)
+ }
+
const instance = createInstance()
const lng = detectLanguage(request)
const ns = i18next.getRouteNamespaces(remixContext)
diff --git a/app/routes/$.tsx b/app/routes/$.tsx
index ac2cf7bb8..379bf8ec8 100644
--- a/app/routes/$.tsx
+++ b/app/routes/$.tsx
@@ -1,10 +1,15 @@
import type { LoaderFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
import { json } from '@remix-run/node'
import NotFound from 'pages/NotFound'
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
+
export const loader: LoaderFunction = () => {
- return json(null, { status: 404 });
-};
+ return json(null, { status: 404 })
+}
export default function Index() {
return <NotFound />
diff --git a/app/routes/billing.tsx b/app/routes/billing.tsx
index 7345667be..b7794f759 100644
--- a/app/routes/billing.tsx
+++ b/app/routes/billing.tsx
@@ -1,5 +1,10 @@
import Billing from 'pages/Billing'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [{ title: 'Billing' }, { name: 'description', content: 'Billing' }]
diff --git a/app/routes/change-email.$id.tsx b/app/routes/change-email.$id.tsx
index 33ac0174b..cb2c8dd20 100644
--- a/app/routes/change-email.$id.tsx
+++ b/app/routes/change-email.$id.tsx
@@ -1,5 +1,10 @@
import VerifyEmail from 'pages/Auth/VerifyEmail'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/changelog.tsx b/app/routes/changelog.tsx
index e733be31b..c2d116164 100644
--- a/app/routes/changelog.tsx
+++ b/app/routes/changelog.tsx
@@ -1,5 +1,10 @@
import Changelog from 'pages/Changelog'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.9,
+})
export const meta: V2_MetaFunction = () => {
return [{ title: 'Changelog' }, { name: 'description', content: 'Changelog' }]
diff --git a/app/routes/dashboard.tsx b/app/routes/dashboard.tsx
index 32b093392..478d840a8 100644
--- a/app/routes/dashboard.tsx
+++ b/app/routes/dashboard.tsx
@@ -1,5 +1,10 @@
import Dashboard from 'pages/Dashboard'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/features.tsx b/app/routes/features.tsx
index 7c0a0cebb..7ce527930 100644
--- a/app/routes/features.tsx
+++ b/app/routes/features.tsx
@@ -1,5 +1,10 @@
import Features from 'pages/Features'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.9,
+})
export const meta: V2_MetaFunction = () => {
return [{ title: 'Features' }, { name: 'description', content: 'Features' }]
diff --git a/app/routes/index.tsx b/app/routes/index.tsx
index e63775d97..2a4a5895d 100644
--- a/app/routes/index.tsx
+++ b/app/routes/index.tsx
@@ -1,5 +1,10 @@
import MainPage from 'pages/MainPage'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 1,
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/password-reset.$id.tsx b/app/routes/password-reset.$id.tsx
index 7313322c1..1b36c677f 100644
--- a/app/routes/password-reset.$id.tsx
+++ b/app/routes/password-reset.$id.tsx
@@ -1,5 +1,10 @@
import CreateNewPassword from 'pages/Auth/CreateNewPassword'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/privacy.tsx b/app/routes/privacy.tsx
index 1c10d875e..6a2872ead 100644
--- a/app/routes/privacy.tsx
+++ b/app/routes/privacy.tsx
@@ -1,5 +1,11 @@
import Privacy from 'pages/Privacy'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.9,
+ changefreq: 'monthly',
+})
export const meta: V2_MetaFunction = () => {
return [{ title: 'Privacy Policy' }, { name: 'description', content: 'Privacy' }]
diff --git a/app/routes/share.$id.tsx b/app/routes/share.$id.tsx
index d35a9bc49..00193be21 100644
--- a/app/routes/share.$id.tsx
+++ b/app/routes/share.$id.tsx
@@ -1,5 +1,10 @@
import ConfirmShare from 'pages/Project/ConfirmShare'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/signup.tsx b/app/routes/signup.tsx
index 48cddf87e..f893e90be 100644
--- a/app/routes/signup.tsx
+++ b/app/routes/signup.tsx
@@ -1,5 +1,10 @@
import Singup from 'pages/Auth/Signup'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.9,
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/socialised.tsx b/app/routes/socialised.tsx
index e009f4ef3..9192049b9 100644
--- a/app/routes/socialised.tsx
+++ b/app/routes/socialised.tsx
@@ -1,5 +1,10 @@
import Socialised from 'pages/Auth/Socialised'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [{ title: 'Socialised' }, { name: 'description', content: 'Socialised' }]
diff --git a/app/routes/terms.tsx b/app/routes/terms.tsx
index ef9fb8732..8f3676bba 100644
--- a/app/routes/terms.tsx
+++ b/app/routes/terms.tsx
@@ -1,5 +1,11 @@
import Terms from 'pages/Terms'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.9,
+ changefreq: 'monthly',
+})
export const meta: V2_MetaFunction = () => {
return [{ title: 'Terms and Conditions' }, { name: 'description', content: 'Terms' }]
diff --git a/app/routes/user-settings.tsx b/app/routes/user-settings.tsx
index 34c4294f0..b6a846083 100644
--- a/app/routes/user-settings.tsx
+++ b/app/routes/user-settings.tsx
@@ -1,5 +1,10 @@
import UserSettings from 'pages/UserSettings'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/app/routes/verify-email.$id.tsx b/app/routes/verify-email.$id.tsx
index 1b975609e..971628ad9 100644
--- a/app/routes/verify-email.$id.tsx
+++ b/app/routes/verify-email.$id.tsx
@@ -1,5 +1,10 @@
import VerifyEmail from 'pages/Auth/VerifyEmail'
import type { V2_MetaFunction } from '@remix-run/node'
+import type { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ exclude: true
+})
export const meta: V2_MetaFunction = () => {
return [
diff --git a/package.json b/package.json
index 229f60d70..eafbf4eaa 100644
--- a/package.json
+++ b/package.json
@@ -60,6 +60,7 @@
"redux": "^4.2.1",
"redux-saga": "^1.2.3",
"remix-i18next": "^5.1.1",
+ "remix-sitemap": "^2.1.0",
"spacetime": "^7.4.3",
"swetrix": "^2.2.1",
"timezone-soft": "^1.4.1"