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!

Add DISABLE_MARKETING_PAGES

Blue Mouse5d9bca491f4d
diff --git a/web/.env.example b/web/.env.example
index ede025e14..7f25fbd79 100644
--- a/web/.env.example
+++ b/web/.env.example
@@ -3,4 +3,5 @@ API_STAGING_URL=http://localhost:5005/
CDN_URL=https://cdn.swetrix.com/
AIAPI_URL=https://aiapi.swetrix.com/
+DISABLE_MARKETING_PAGES=
PADDLE_CLIENT_SIDE_TOKEN=
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index 6940a7748..a7178850c 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -376,6 +376,9 @@ const PRODUCTION_API_URL = isBrowser ? window.REMIX_ENV?.API_URL : process.env.A
export const isSelfhosted = Boolean(isBrowser ? window.REMIX_ENV?.SELFHOSTED : process.env.__SELFHOSTED)
+export const isDisableMarketingPages =
+ (isBrowser ? window.REMIX_ENV?.DISABLE_MARKETING_PAGES : process.env.DISABLE_MARKETING_PAGES) === 'true'
+
const apiUrlUnprocessed = isSelfhosted || !isStaging ? PRODUCTION_API_URL : STAGING_API_URL
const aiApiUrlUnprocessed = isBrowser ? window.REMIX_ENV?.AIAPI_URL : process.env.AIAPI_URL
const cdnUrlUnprocessed = isBrowser ? window.REMIX_ENV?.CDN_URL : process.env.CDN_URL
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 0d8ff878d..878ecea08 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -187,6 +187,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
API_STAGING_URL: process.env.API_STAGING_URL,
CDN_URL: process.env.CDN_URL,
SELFHOSTED: process.env.__SELFHOSTED,
+ DISABLE_MARKETING_PAGES: process.env.DISABLE_MARKETING_PAGES,
STAGING: process.env.STAGING,
PADDLE_CLIENT_SIDE_TOKEN: process.env.PADDLE_CLIENT_SIDE_TOKEN,
}
diff --git a/web/app/routes/about.tsx b/web/app/routes/about.tsx
index 4e5865933..60fbf1a63 100644
--- a/web/app/routes/about.tsx
+++ b/web/app/routes/about.tsx
@@ -1,9 +1,15 @@
import { redirect } from '@remix-run/node'
import About from '~/pages/About'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 1,
+ exclude: isSelfhosted || isDisableMarketingPages,
+})
export async function loader() {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/dashboard', 302)
}
diff --git a/web/app/routes/blog.$category.$slug.tsx b/web/app/routes/blog.$category.$slug.tsx
index 2cfe94e12..31befaf47 100644
--- a/web/app/routes/blog.$category.$slug.tsx
+++ b/web/app/routes/blog.$category.$slug.tsx
@@ -2,7 +2,7 @@ import type { LoaderFunction, LinksFunction, MetaFunction } from '@remix-run/nod
import { redirect, data } from '@remix-run/node'
import singlePostCss from '~/css/mdfile.css'
import { getPost } from '~/utils/getPosts'
-import { isSelfhosted, TITLE_SUFFIX, getOgImageUrl } from '~/lib/constants'
+import { isSelfhosted, TITLE_SUFFIX, getOgImageUrl, isDisableMarketingPages } from '~/lib/constants'
import Post from '~/pages/Blog/Post'
export const links: LinksFunction = () => {
@@ -48,7 +48,7 @@ export const meta: MetaFunction = (loaderData: any) => {
}
export const loader: LoaderFunction = async ({ params }) => {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/dashboard', 302)
}
diff --git a/web/app/routes/blog.$slug.tsx b/web/app/routes/blog.$slug.tsx
index 0407b509e..50345254d 100644
--- a/web/app/routes/blog.$slug.tsx
+++ b/web/app/routes/blog.$slug.tsx
@@ -8,7 +8,7 @@ import _isString from 'lodash/isString'
import singlePostCss from '~/css/mdfile.css'
import { getPost, getSlugFromFilename, getDateFromFilename } from '~/utils/getPosts'
import { getSitemap } from '~/api'
-import { isSelfhosted, TITLE_SUFFIX, getOgImageUrl } from '~/lib/constants'
+import { isSelfhosted, TITLE_SUFFIX, getOgImageUrl, isDisableMarketingPages } from '~/lib/constants'
import Post from '~/pages/Blog/Post'
export const links: LinksFunction = () => {
@@ -57,6 +57,12 @@ export const meta: MetaFunction = (loaderData: any) => {
export const sitemap: SitemapFunction = async () => {
const files = await getSitemap()
+ if (isSelfhosted || isDisableMarketingPages) {
+ return {
+ exclude: true,
+ }
+ }
+
return _map(files, (file) => {
let handle: string
let date: string
@@ -79,7 +85,7 @@ export const sitemap: SitemapFunction = async () => {
}
export const loader: LoaderFunction = async ({ params }) => {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/dashboard', 302)
}
diff --git a/web/app/routes/blog.tsx b/web/app/routes/blog.tsx
index a3a517684..8330d4173 100644
--- a/web/app/routes/blog.tsx
+++ b/web/app/routes/blog.tsx
@@ -4,11 +4,11 @@ import { Link, useLoaderData } from '@remix-run/react'
import _map from 'lodash/map'
import _isEmpty from 'lodash/isEmpty'
import _filter from 'lodash/filter'
-import { isSelfhosted, TITLE_SUFFIX } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted, TITLE_SUFFIX } from '~/lib/constants'
import { getBlogPosts } from '~/api'
export const loader: LoaderFunction = async () => {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/dashboard', 302)
}
diff --git a/web/app/routes/contact.tsx b/web/app/routes/contact.tsx
index 29e2cf7ba..b37e0499e 100644
--- a/web/app/routes/contact.tsx
+++ b/web/app/routes/contact.tsx
@@ -1,9 +1,15 @@
import { redirect } from '@remix-run/node'
import Contact from '~/pages/Contact'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import { SitemapFunction } from 'remix-sitemap'
+
+export const sitemap: SitemapFunction = () => ({
+ priority: 1,
+ exclude: isSelfhosted || isDisableMarketingPages,
+})
export async function loader() {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/dashboard', 302)
}
diff --git a/web/app/routes/error-tracking.tsx b/web/app/routes/error-tracking.tsx
index 84d1fdec2..075a507a5 100644
--- a/web/app/routes/error-tracking.tsx
+++ b/web/app/routes/error-tracking.tsx
@@ -5,15 +5,15 @@ import type { SitemapFunction } from 'remix-sitemap'
import ErrorTracking from '~/pages/ErrorTracking'
import { detectTheme, isAuthenticated } from '~/utils/server'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 1,
- exclude: isSelfhosted,
+ exclude: isSelfhosted || isDisableMarketingPages,
})
export async function loader({ request }: LoaderFunctionArgs) {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
diff --git a/web/app/routes/for-marketers.tsx b/web/app/routes/for-marketers.tsx
index 496ad3af1..68c9e6904 100644
--- a/web/app/routes/for-marketers.tsx
+++ b/web/app/routes/for-marketers.tsx
@@ -4,17 +4,18 @@ import { redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
import { detectTheme, isAuthenticated } from '~/utils/server'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
- exclude: isSelfhosted,
+ exclude: isSelfhosted || isDisableMarketingPages,
})
export async function loader({ request }: LoaderFunctionArgs) {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
+
const isAuth = isAuthenticated(request)
const [theme] = detectTheme(request)
diff --git a/web/app/routes/for-small-businesses.tsx b/web/app/routes/for-small-businesses.tsx
index 007e1dda8..511d6b27c 100644
--- a/web/app/routes/for-small-businesses.tsx
+++ b/web/app/routes/for-small-businesses.tsx
@@ -4,17 +4,18 @@ import { redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
import { detectTheme, isAuthenticated } from '~/utils/server'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
- exclude: isSelfhosted,
+ exclude: isSelfhosted || isDisableMarketingPages,
})
export async function loader({ request }: LoaderFunctionArgs) {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
+
const isAuth = isAuthenticated(request)
const [theme] = detectTheme(request)
diff --git a/web/app/routes/for-startups.tsx b/web/app/routes/for-startups.tsx
index f54b66eed..e38afea57 100644
--- a/web/app/routes/for-startups.tsx
+++ b/web/app/routes/for-startups.tsx
@@ -4,17 +4,18 @@ import { redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
import { detectTheme, isAuthenticated } from '~/utils/server'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
- exclude: isSelfhosted,
+ exclude: isSelfhosted || isDisableMarketingPages,
})
export async function loader({ request }: LoaderFunctionArgs) {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
+
const isAuth = isAuthenticated(request)
const [theme] = detectTheme(request)
diff --git a/web/app/routes/imprint.tsx b/web/app/routes/imprint.tsx
index 78db4f973..e76e2bc5f 100644
--- a/web/app/routes/imprint.tsx
+++ b/web/app/routes/imprint.tsx
@@ -1,11 +1,22 @@
import Imprint from '~/pages/Imprint'
import type { SitemapFunction } from 'remix-sitemap'
+import { redirect } from '@remix-run/node'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
changefreq: 'monthly',
+ exclude: isSelfhosted || isDisableMarketingPages,
})
+export async function loader() {
+ if (isSelfhosted || isDisableMarketingPages) {
+ return redirect('/login', 302)
+ }
+
+ return null
+}
+
export default function Index() {
return <Imprint />
}
diff --git a/web/app/routes/index.tsx b/web/app/routes/index.tsx
index d1772e261..c8cec63fe 100644
--- a/web/app/routes/index.tsx
+++ b/web/app/routes/index.tsx
@@ -25,6 +25,7 @@ import {
OS_LOGO_MAP,
OS_LOGO_MAP_DARK,
BROWSER_LOGO_MAP,
+ isDisableMarketingPages,
} from '~/lib/constants'
import { StateType } from '~/lib/store/index'
import { Cookie, FileTextIcon } from 'lucide-react'
@@ -44,11 +45,11 @@ import { ConveyorBelt } from '~/components/marketing/ConveyorBelt'
export const sitemap: SitemapFunction = () => ({
priority: 1,
- exclude: isSelfhosted,
+ exclude: isSelfhosted || isDisableMarketingPages,
})
export async function loader({ request }: LoaderFunctionArgs) {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
diff --git a/web/app/routes/open.tsx b/web/app/routes/open.tsx
index dacd3f12d..fbb12f1df 100644
--- a/web/app/routes/open.tsx
+++ b/web/app/routes/open.tsx
@@ -1,16 +1,21 @@
import OpenStartup from '~/pages/OpenStartup'
import { redirect } from '@remix-run/node'
import type { LinksFunction } from '@remix-run/node'
-import { isSelfhosted } from '~/lib/constants'
-
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import type { SitemapFunction } from 'remix-sitemap'
import Style from '~/styles/ProjectViewStyle.css'
export const links: LinksFunction = () => {
return [{ rel: 'stylesheet', href: Style }]
}
+export const sitemap: SitemapFunction = () => ({
+ priority: 0.8,
+ exclude: isSelfhosted || isDisableMarketingPages,
+})
+
export async function loader() {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
diff --git a/web/app/routes/pay.tsx b/web/app/routes/pay.tsx
index 4257eb9b9..fb1eea45a 100644
--- a/web/app/routes/pay.tsx
+++ b/web/app/routes/pay.tsx
@@ -5,7 +5,7 @@ import { ExternalScriptsHandle } from 'remix-utils/external-scripts'
import { isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
- priority: 0.9,
+ exclude: true,
})
export let handle: ExternalScriptsHandle = {
diff --git a/web/app/routes/performance.tsx b/web/app/routes/performance.tsx
index 44e225189..a466c3ea8 100644
--- a/web/app/routes/performance.tsx
+++ b/web/app/routes/performance.tsx
@@ -5,15 +5,15 @@ import { redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
import { detectTheme, isAuthenticated } from '~/utils/server'
-import { isSelfhosted } from '~/lib/constants'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 1,
- exclude: isSelfhosted,
+ exclude: isSelfhosted || isDisableMarketingPages,
})
export async function loader({ request }: LoaderFunctionArgs) {
- if (isSelfhosted) {
+ if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
diff --git a/web/app/routes/press.tsx b/web/app/routes/press.tsx
index 22fe33070..6a694b7c1 100644
--- a/web/app/routes/press.tsx
+++ b/web/app/routes/press.tsx
@@ -1,5 +1,21 @@
+import { redirect } from '@remix-run/node'
+import { SitemapFunction } from 'remix-sitemap'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
import Press from '~/pages/Press'
+export const sitemap: SitemapFunction = () => ({
+ priority: 1,
+ exclude: isSelfhosted || isDisableMarketingPages,
+})
+
+export async function loader() {
+ if (isSelfhosted || isDisableMarketingPages) {
+ return redirect('/login', 302)
+ }
+
+ return null
+}
+
export default function Index() {
return <Press />
}