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!

set translated title server-side

Blue Mousec3793db04c30
diff --git a/app/root.tsx b/app/root.tsx
index 5be32a405..2bbabc04f 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -23,7 +23,7 @@ import { useChangeLanguage } from 'remix-i18next'
import { useTranslation } from 'react-i18next'
import AppWrapper from 'App'
import { detectLanguage } from 'i18n'
-import { detectTheme } from 'utils/server'
+import { detectTheme, getPageMeta } from 'utils/server'
import mainCss from 'styles/index.css'
import tailwindCss from 'styles/tailwind.css'
@@ -92,7 +92,8 @@ export default function App() {
const {
locale, url, theme,
} = useLoaderData<typeof loader>()
- const { i18n } = useTranslation()
+ const { i18n, t } = useTranslation('common')
+ const { title } = getPageMeta(t, url)
const alternateLinks = _map(whitelist, (lc) => ({
rel: 'alternate',
@@ -106,6 +107,7 @@ export default function App() {
<html className={theme} lang={locale} dir={i18n.dir()}>
<head>
<meta charSet='utf-8' />
+ <title>{title}</title>
<meta name='viewport' content='width=device-width,initial-scale=1' />
<Meta />
<Links />
diff --git a/app/routes/about.tsx b/app/routes/about.tsx
index f69f18a68..9e5871406 100644
--- a/app/routes/about.tsx
+++ b/app/routes/about.tsx
@@ -1,19 +1,4 @@
import About from 'pages/About'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'About' },
- {
- name: 'description',
- content: 'About page',
- },
- {
- name: 'keywords',
- content: 'about',
- },
- ]
-}
export default function Index() {
return <About />
diff --git a/app/routes/billing.tsx b/app/routes/billing.tsx
index 121b49014..a26c33a94 100644
--- a/app/routes/billing.tsx
+++ b/app/routes/billing.tsx
@@ -1,15 +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' }]
-}
-
export default function Index() {
return <Billing />
}
diff --git a/app/routes/captchas.$id.tsx b/app/routes/captchas.$id.tsx
index bf21b37ac..07470b59d 100644
--- a/app/routes/captchas.$id.tsx
+++ b/app/routes/captchas.$id.tsx
@@ -1,16 +1,7 @@
import CaptchaView from 'pages/Captcha/View'
-import type { V2_MetaFunction, LinksFunction } from '@remix-run/node'
+import type { LinksFunction } from '@remix-run/node'
import ProjectViewStyle from 'styles/ProjectViewStyle.css'
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Captcha View',
- description: 'Captcha View',
- },
- ]
-}
-
export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: ProjectViewStyle },
]
diff --git a/app/routes/captchas.new.tsx b/app/routes/captchas.new.tsx
index 174bfc99d..e5e637a95 100644
--- a/app/routes/captchas.new.tsx
+++ b/app/routes/captchas.new.tsx
@@ -1,14 +1,4 @@
import CaptchaSettings from 'pages/Captcha/Settings'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Captcha Settings',
- description: 'Captcha Settings',
- },
- ]
-}
export default function Index() {
return <CaptchaSettings />
diff --git a/app/routes/captchas.settings.$id.tsx b/app/routes/captchas.settings.$id.tsx
index 174bfc99d..e5e637a95 100644
--- a/app/routes/captchas.settings.$id.tsx
+++ b/app/routes/captchas.settings.$id.tsx
@@ -1,14 +1,4 @@
import CaptchaSettings from 'pages/Captcha/Settings'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Captcha Settings',
- description: 'Captcha Settings',
- },
- ]
-}
export default function Index() {
return <CaptchaSettings />
diff --git a/app/routes/change-email.$id.tsx b/app/routes/change-email.$id.tsx
index 4c70262e5..7fa46c5db 100644
--- a/app/routes/change-email.$id.tsx
+++ b/app/routes/change-email.$id.tsx
@@ -1,6 +1,6 @@
import VerifyEmail from 'pages/Auth/VerifyEmail'
import type { SitemapFunction } from 'remix-sitemap'
-import type { V2_MetaFunction, HeadersFunction } from '@remix-run/node'
+import type { HeadersFunction } from '@remix-run/node'
export const headers: HeadersFunction = () => {
return {
@@ -12,13 +12,6 @@ export const sitemap: SitemapFunction = () => ({
exclude: true,
})
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'Change Email' },
- { name: 'description', content: 'Change Email' },
- ]
-}
-
export default function Index() {
return <VerifyEmail />
}
diff --git a/app/routes/changelog.tsx b/app/routes/changelog.tsx
index c2d116164..343279a03 100644
--- a/app/routes/changelog.tsx
+++ b/app/routes/changelog.tsx
@@ -1,15 +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' }]
-}
-
export default function Index() {
return <Changelog />
}
diff --git a/app/routes/contact.tsx b/app/routes/contact.tsx
index c4da36506..16867717c 100644
--- a/app/routes/contact.tsx
+++ b/app/routes/contact.tsx
@@ -1,9 +1,4 @@
import Contact from 'pages/Contact'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [{ title: 'Contact' }, { name: 'description', content: 'Contact' }]
-}
export default function Index() {
return <Contact />
diff --git a/app/routes/cookie-policy.tsx b/app/routes/cookie-policy.tsx
index 50da776b9..6e8eb2e7e 100644
--- a/app/routes/cookie-policy.tsx
+++ b/app/routes/cookie-policy.tsx
@@ -1,9 +1,4 @@
import CookiePolicy from 'pages/CookiePolicy'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [{ title: 'Cookie Policy' }, { name: 'description', content: 'CookiePolicy' }]
-}
export default function Index() {
return <CookiePolicy />
diff --git a/app/routes/dashboard.tsx b/app/routes/dashboard.tsx
index 30fb2b311..7df10bd8a 100644
--- a/app/routes/dashboard.tsx
+++ b/app/routes/dashboard.tsx
@@ -1,20 +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 [
- {
- title: 'Dashboard',
- description: 'Dashboard',
- },
- ]
-}
-
export default function Index() {
return <Dashboard />
}
diff --git a/app/routes/features.tsx b/app/routes/features.tsx
index 7ce527930..a75f230d1 100644
--- a/app/routes/features.tsx
+++ b/app/routes/features.tsx
@@ -1,15 +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' }]
-}
-
export default function Index() {
return <Features />
}
diff --git a/app/routes/index.tsx b/app/routes/index.tsx
index e4f372cb8..326c1dfb4 100644
--- a/app/routes/index.tsx
+++ b/app/routes/index.tsx
@@ -1,5 +1,5 @@
import MainPage from 'pages/MainPage'
-import type { V2_MetaFunction, LoaderArgs } from '@remix-run/node'
+import type { LoaderArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
@@ -10,20 +10,6 @@ export const sitemap: SitemapFunction = () => ({
priority: 1,
})
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'Swetrix Analytics' },
- {
- name: 'description',
- content: 'Swetrix Analytics is a privacy-focused, open-source alternative to Google Analytics.',
- },
- {
- name: 'keywords',
- content: 'analytics, google analytics, privacy, open-source, alternative',
- },
- ]
-}
-
export async function loader({ request }: LoaderArgs) {
const theme = detectTheme(request)
diff --git a/app/routes/login.tsx b/app/routes/login.tsx
index bf1ed22ac..f4dbcb4ed 100644
--- a/app/routes/login.tsx
+++ b/app/routes/login.tsx
@@ -1,5 +1,5 @@
import Signin from 'pages/Auth/Signin'
-import type { V2_MetaFunction, HeadersFunction } from '@remix-run/node'
+import type { HeadersFunction } from '@remix-run/node'
export const headers: HeadersFunction = () => {
return {
@@ -7,20 +7,6 @@ export const headers: HeadersFunction = () => {
}
}
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'Login' },
- {
- name: 'description',
- content: 'Login to your account',
- },
- {
- name: 'keywords',
- content: 'login, sign in',
- },
- ]
-}
-
export default function Index() {
return <Signin />
}
diff --git a/app/routes/open-startup.tsx b/app/routes/open-startup.tsx
index b6be497ab..9f2d630df 100644
--- a/app/routes/open-startup.tsx
+++ b/app/routes/open-startup.tsx
@@ -1,9 +1,4 @@
import OpenStartup from 'pages/OpenStartup'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [{ title: 'OpenStartup' }, { name: 'description', content: 'OpenStartup' }]
-}
export default function Index() {
return <OpenStartup />
diff --git a/app/routes/password-reset.$id.tsx b/app/routes/password-reset.$id.tsx
index d08192ab1..dd850e871 100644
--- a/app/routes/password-reset.$id.tsx
+++ b/app/routes/password-reset.$id.tsx
@@ -1,6 +1,6 @@
import CreateNewPassword from 'pages/Auth/CreateNewPassword'
import type { SitemapFunction } from 'remix-sitemap'
-import type { V2_MetaFunction, HeadersFunction } from '@remix-run/node'
+import type { HeadersFunction } from '@remix-run/node'
export const headers: HeadersFunction = () => {
return {
@@ -12,20 +12,6 @@ export const sitemap: SitemapFunction = () => ({
exclude: true,
})
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'Reset password' },
- {
- name: 'description',
- content: 'Reset your password',
- },
- {
- name: 'keywords',
- content: 'reset, password, forgot, forgot password',
- },
- ]
-}
-
export default function Index() {
return <CreateNewPassword />
}
diff --git a/app/routes/press.tsx b/app/routes/press.tsx
index 9dbb29810..d1ac487cc 100644
--- a/app/routes/press.tsx
+++ b/app/routes/press.tsx
@@ -1,9 +1,4 @@
import Press from 'pages/Press'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [{ title: 'Press' }, { name: 'description', content: 'Press' }]
-}
export default function Index() {
return <Press />
diff --git a/app/routes/privacy.tsx b/app/routes/privacy.tsx
index 6a2872ead..97215b907 100644
--- a/app/routes/privacy.tsx
+++ b/app/routes/privacy.tsx
@@ -1,5 +1,4 @@
import Privacy from 'pages/Privacy'
-import type { V2_MetaFunction } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
export const sitemap: SitemapFunction = () => ({
@@ -7,10 +6,6 @@ export const sitemap: SitemapFunction = () => ({
changefreq: 'monthly',
})
-export const meta: V2_MetaFunction = () => {
- return [{ title: 'Privacy Policy' }, { name: 'description', content: 'Privacy' }]
-}
-
export default function Index() {
return <Privacy />
}
diff --git a/app/routes/project.transfer.cancel.tsx b/app/routes/project.transfer.cancel.tsx
index 6a1be4c4c..c7613b21f 100644
--- a/app/routes/project.transfer.cancel.tsx
+++ b/app/routes/project.transfer.cancel.tsx
@@ -1,20 +1,10 @@
import TransferProjectConfirm from 'pages/Project/Settings/TransferProject/TransferProjectConfirm'
-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: 'Transfer Project Confirm',
- description: 'Transfer Project Confirm',
- },
- ]
-}
-
export default function Index() {
return <TransferProjectConfirm />
}
diff --git a/app/routes/project.transfer.confirm.tsx b/app/routes/project.transfer.confirm.tsx
index 6a1be4c4c..c7613b21f 100644
--- a/app/routes/project.transfer.confirm.tsx
+++ b/app/routes/project.transfer.confirm.tsx
@@ -1,20 +1,10 @@
import TransferProjectConfirm from 'pages/Project/Settings/TransferProject/TransferProjectConfirm'
-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: 'Transfer Project Confirm',
- description: 'Transfer Project Confirm',
- },
- ]
-}
-
export default function Index() {
return <TransferProjectConfirm />
}
diff --git a/app/routes/projects.$id.alerts.create.tsx b/app/routes/projects.$id.alerts.create.tsx
index 44d6914d1..952e17bdb 100644
--- a/app/routes/projects.$id.alerts.create.tsx
+++ b/app/routes/projects.$id.alerts.create.tsx
@@ -1,14 +1,4 @@
import ProjectAlertsSettings from 'pages/Project/Alerts/Settings'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Project Alerts Settings',
- description: 'Project Alerts Settings',
- },
- ]
-}
export default function Index() {
return <ProjectAlertsSettings />
diff --git a/app/routes/projects.$id.password.tsx b/app/routes/projects.$id.password.tsx
index 264d8336c..c0c08700f 100644
--- a/app/routes/projects.$id.password.tsx
+++ b/app/routes/projects.$id.password.tsx
@@ -1,14 +1,4 @@
import ProjectProtectedPassword from 'pages/Project/ProjectProtectedPassword'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Project Password',
- description: 'Project Password',
- },
- ]
-}
export default function Index() {
return <ProjectProtectedPassword />
diff --git a/app/routes/projects.$id.subscribers.invite.tsx b/app/routes/projects.$id.subscribers.invite.tsx
index 6e768c4be..a482b8c96 100644
--- a/app/routes/projects.$id.subscribers.invite.tsx
+++ b/app/routes/projects.$id.subscribers.invite.tsx
@@ -1,14 +1,4 @@
import ConfirmReportsShare from 'pages/Project/Settings/Emails/ConfirmReportsShare'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Confirm Reports Share',
- description: 'Confirm Reports Share',
- },
- ]
-}
export default function Index() {
return <ConfirmReportsShare />
diff --git a/app/routes/projects.$id.tsx b/app/routes/projects.$id.tsx
index b4d7ead31..cb1444fa9 100644
--- a/app/routes/projects.$id.tsx
+++ b/app/routes/projects.$id.tsx
@@ -1,15 +1,7 @@
import ViewProject from 'pages/Project/View'
-import type { V2_MetaFunction, LinksFunction } from '@remix-run/node'
+import type { LinksFunction } from '@remix-run/node'
import ProjectViewStyle from 'styles/ProjectViewStyle.css'
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'View Project',
- description: 'View Project',
- },
- ]
-}
export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: ProjectViewStyle },
diff --git a/app/routes/projects.$pid.alerts.settings.$id.tsx b/app/routes/projects.$pid.alerts.settings.$id.tsx
index 44d6914d1..952e17bdb 100644
--- a/app/routes/projects.$pid.alerts.settings.$id.tsx
+++ b/app/routes/projects.$pid.alerts.settings.$id.tsx
@@ -1,14 +1,4 @@
import ProjectAlertsSettings from 'pages/Project/Alerts/Settings'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Project Alerts Settings',
- description: 'Project Alerts Settings',
- },
- ]
-}
export default function Index() {
return <ProjectAlertsSettings />
diff --git a/app/routes/projects.new.tsx b/app/routes/projects.new.tsx
index 5a763ce22..d3c0531ae 100644
--- a/app/routes/projects.new.tsx
+++ b/app/routes/projects.new.tsx
@@ -1,23 +1,10 @@
import ProjectSettings from 'pages/Project/Settings'
-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: 'Project Settings',
- },
- {
- name: 'description',
- content: 'Project Settings',
- },
- ]
-}
-
export default function Index() {
return <ProjectSettings />
}
diff --git a/app/routes/projects.settings.$id.tsx b/app/routes/projects.settings.$id.tsx
index 998c3d674..8665e5159 100644
--- a/app/routes/projects.settings.$id.tsx
+++ b/app/routes/projects.settings.$id.tsx
@@ -1,14 +1,4 @@
import ProjectSettings from 'pages/Project/Settings'
-import type { V2_MetaFunction } from '@remix-run/node'
-
-export const meta: V2_MetaFunction = () => {
- return [
- {
- title: 'Project Settings',
- description: 'Project Settings',
- },
- ]
-}
export default function Index() {
return <ProjectSettings />
diff --git a/app/routes/recovery.tsx b/app/routes/recovery.tsx
index f873388d3..99d04cc39 100644
--- a/app/routes/recovery.tsx
+++ b/app/routes/recovery.tsx
@@ -1,5 +1,5 @@
import ForgotPassword from 'pages/Auth/ForgotPassword'
-import type { V2_MetaFunction, HeadersFunction } from '@remix-run/node'
+import type { HeadersFunction } from '@remix-run/node'
export const headers: HeadersFunction = () => {
return {
@@ -7,20 +7,6 @@ export const headers: HeadersFunction = () => {
}
}
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'Forgot password' },
- {
- name: 'description',
- content: 'Forgot your password',
- },
- {
- name: 'keywords',
- content: 'reset, password, forgot, forgot password',
- },
- ]
-}
-
export default function Index() {
return <ForgotPassword />
}
diff --git a/app/routes/share.$id.tsx b/app/routes/share.$id.tsx
index e60ffd052..97cb46413 100644
--- a/app/routes/share.$id.tsx
+++ b/app/routes/share.$id.tsx
@@ -1,20 +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 [
- {
- title: 'ConfirmShare',
- description: 'ConfirmShare',
- },
- ]
-}
-
export default function Index() {
return <ConfirmShare />
}
diff --git a/app/routes/signup.tsx b/app/routes/signup.tsx
index f801dea1c..fe0be7e69 100644
--- a/app/routes/signup.tsx
+++ b/app/routes/signup.tsx
@@ -1,6 +1,6 @@
import Singup from 'pages/Auth/Signup'
import type { SitemapFunction } from 'remix-sitemap'
-import type { V2_MetaFunction, HeadersFunction } from '@remix-run/node'
+import type { HeadersFunction } from '@remix-run/node'
export const headers: HeadersFunction = () => {
return {
@@ -12,13 +12,6 @@ export const sitemap: SitemapFunction = () => ({
priority: 0.9,
})
-export const meta: V2_MetaFunction = () => {
- return [
- { title: 'Singup' },
- { name: 'description', content: 'Singup' },
- ]
-}
-
export default function Index() {
return <Singup />
}
diff --git a/app/routes/socialised.tsx b/app/routes/socialised.tsx
index eaf05e428..6518d18c0 100644
--- a/app/routes/socialised.tsx
+++ b/app/routes/socialised.tsx
@@ -1,15 +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' }]
-}
-
export default function Index() {
return <Socialised />
}
diff --git a/app/routes/terms.tsx b/app/routes/terms.tsx
index 8f3676bba..af722285f 100644
--- a/app/routes/terms.tsx
+++ b/app/routes/terms.tsx
@@ -1,5 +1,4 @@
import Terms from 'pages/Terms'
-import type { V2_MetaFunction } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
export const sitemap: SitemapFunction = () => ({
@@ -7,10 +6,6 @@ export const sitemap: SitemapFunction = () => ({
changefreq: 'monthly',
})
-export const meta: V2_MetaFunction = () => {
- return [{ title: 'Terms and Conditions' }, { name: 'description', content: 'Terms' }]
-}
-
export default function Index() {
return <Terms />
}
diff --git a/app/routes/user-settings.tsx b/app/routes/user-settings.tsx
index b8a23b1f0..f1f8ff41f 100644
--- a/app/routes/user-settings.tsx
+++ b/app/routes/user-settings.tsx
@@ -1,20 +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 [
- {
- title: 'UserSettings',
- description: 'UserSettings',
- },
- ]
-}
-
export default function Index() {
return <UserSettings />
}
diff --git a/app/routes/verify-email.$id.tsx b/app/routes/verify-email.$id.tsx
index c6566bc75..d610ebc93 100644
--- a/app/routes/verify-email.$id.tsx
+++ b/app/routes/verify-email.$id.tsx
@@ -1,18 +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 [
- { title: 'VerifyEmail' },
- { name: 'description', content: 'VerifyEmail' },
- ]
-}
-
export default function Index() {
return <VerifyEmail />
}
diff --git a/app/routesPath/index.ts b/app/routesPath/index.ts
index b37619590..584f4b6dd 100644
--- a/app/routesPath/index.ts
+++ b/app/routesPath/index.ts
@@ -1,37 +1,37 @@
const routes = Object.freeze({
- signin: '/login', // add
- signup: '/signup', // add
- reset_password: '/recovery', // add
- new_password_form: '/password-reset/:id', // add
- confirm_share: '/share/:id', // add
- confirm_subcription: '/projects/:id/subscribers/invite', // add
- main: '/', // add
- dashboard: '/dashboard', // add
- user_settings: '/user-settings', // add
- verify: '/verify-email/:id', // add
- change_email: '/change-email/:id', // add
- new_project: '/projects/new', // add
- new_captcha: '/captchas/new', // add
- project_settings: '/projects/settings/:id', // add
- captcha_settings: '/captchas/settings/:id', // add
- project: '/projects/:id', // add
- captcha: '/captchas/:id', // add
- features: '/features', // add
- billing: '/billing', // add
- privacy: '/privacy', // add
- cookiePolicy: '/cookie-policy', // add
- terms: '/terms', // add
- contact: '/contact', // add
- changelog: '/changelog', // add
- about: '/about', // add
- create_alert: '/projects/:pid/alerts/create', // add
- alert_settings: '/projects/:pid/alerts/settings/:id', // add
- press: '/press', // add
- transfer_confirm: '/project/transfer/confirm', // add
- transfer_reject: '/project/transfer/cancel', // add
- socialised: '/socialised', // add
- project_protected_password: '/projects/:id/password', // add
- open: '/open-startup', // add
+ signin: '/login',
+ signup: '/signup',
+ reset_password: '/recovery',
+ new_password_form: '/password-reset/:id',
+ confirm_share: '/share/:id',
+ confirm_subcription: '/projects/:id/subscribers/invite',
+ main: '/',
+ dashboard: '/dashboard',
+ user_settings: '/user-settings',
+ verify: '/verify-email/:id',
+ change_email: '/change-email/:id',
+ new_project: '/projects/new',
+ new_captcha: '/captchas/new',
+ project_settings: '/projects/settings/:id',
+ captcha_settings: '/captchas/settings/:id',
+ project: '/projects/:id',
+ captcha: '/captchas/:id',
+ features: '/features',
+ billing: '/billing',
+ privacy: '/privacy',
+ cookiePolicy: '/cookie-policy',
+ terms: '/terms',
+ contact: '/contact',
+ changelog: '/changelog',
+ about: '/about',
+ create_alert: '/projects/:pid/alerts/create',
+ alert_settings: '/projects/:pid/alerts/settings/:id',
+ press: '/press',
+ transfer_confirm: '/project/transfer/confirm',
+ transfer_reject: '/project/transfer/cancel',
+ socialised: '/socialised',
+ project_protected_password: '/projects/:id/password',
+ open: '/open-startup',
})
export default routes
diff --git a/app/utils/server.ts b/app/utils/server.ts
index 45835e173..58141700e 100644
--- a/app/utils/server.ts
+++ b/app/utils/server.ts
@@ -1,3 +1,6 @@
+import routes from 'routesPath'
+import { TITLE_SUFFIX } from 'redux/constants'
+
export const hasAuthCookies = (request: Request) => {
const cookie = request.headers.get('Cookie')
const accessToken = cookie?.match(/(?<=access_token=)[^;]*/)?.[0]
@@ -16,3 +19,151 @@ export function detectTheme(request: Request): 'dark' | 'light' {
return 'light'
}
+
+interface IPageMeta {
+ title: string
+}
+
+export const getPageMeta = (
+ t: (key: string) => string,
+ url: string,
+): IPageMeta => {
+ const { pathname } = new URL(url)
+ // TODO: Use t()
+ let result = {
+ title: t('titles.main'),
+ }
+
+ switch (pathname) {
+ case routes.signin:
+ result = {
+ title: t('titles.signin'),
+ }
+ break
+
+ case routes.signup:
+ result = {
+ title: t('titles.signup'),
+ }
+ break
+
+ case routes.reset_password:
+ case routes.new_password_form:
+ result = {
+ title: t('titles.recovery'),
+ }
+ break
+
+ case routes.confirm_share:
+ case routes.confirm_subcription:
+ case routes.transfer_confirm:
+ case routes.transfer_reject:
+ result = {
+ title: t('titles.invitation'),
+ }
+ break
+
+ case routes.dashboard:
+ result = {
+ title: t('titles.dashboard'),
+ }
+ break
+
+ case routes.user_settings:
+ result = {
+ title: t('titles.profileSettings'),
+ }
+ break
+
+ case routes.verify:
+ case routes.change_email:
+ result = {
+ title: t('titles.verification'),
+ }
+ break
+
+ case routes.new_project:
+ case routes.new_captcha:
+ result = {
+ title: t('project.settings.create'),
+ }
+ break
+
+ case routes.features:
+ result = {
+ title: t('titles.features'),
+ }
+ break
+
+ case routes.billing:
+ result = {
+ title: t('titles.billing'),
+ }
+ break
+
+ case routes.privacy:
+ result = {
+ title: 'Privacy Policy',
+ }
+ break
+
+ case routes.cookiePolicy:
+ result = {
+ title: 'Cookie Policy',
+ }
+ break
+
+ case routes.terms:
+ result = {
+ title: 'Terms and Conditions',
+ }
+ break
+
+ case routes.contact:
+ result = {
+ title: t('titles.contact'),
+ }
+ break
+
+ case routes.changelog:
+ result = {
+ title: t('titles.changelog'),
+ }
+ break
+
+ case routes.about:
+ result = {
+ title: 'About us',
+ }
+ break
+
+ case routes.press:
+ result = {
+ title: t('titles.press'),
+ }
+ break
+
+ case routes.socialised:
+ result = {
+ title: t('titles.socialisation'),
+ }
+ break
+
+ case routes.open:
+ result = {
+ title: t('titles.open'),
+ }
+ break
+
+ default:
+ break
+ }
+
+ // project_settings, captcha_settings, project, captcha titles are set dynamically
+
+ // todo: create_alert, alert_settings, project_protected_password,
+
+ result.title += ` ${TITLE_SUFFIX}`
+
+ return result
+}