diff --git a/apps/website/src/hooks.tsx b/apps/website/src/hooks.tsx new file mode 100644 index 000000000..a5d061c74 --- /dev/null +++ b/apps/website/src/hooks.tsx @@ -0,0 +1,11 @@ +import { useEffect } from "preact/hooks"; + +export function usePageTitle(title: string) { + useEffect(() => { + if (title.length) { + document.title = `${title} - Trilium Notes`; + } else { + document.title = "Trilium Notes"; + } + }, [ title ]); +} diff --git a/apps/website/src/pages/Donate/Donate.tsx b/apps/website/src/pages/Donate/Donate.tsx index 629909247..e8a33763b 100644 --- a/apps/website/src/pages/Donate/Donate.tsx +++ b/apps/website/src/pages/Donate/Donate.tsx @@ -5,8 +5,11 @@ import paypalIcon from "../../assets/boxicons/bx-paypal.svg?raw"; import buyMeACoffeeIcon from "../../assets/boxicons/bx-buy-me-a-coffee.svg?raw"; import Button from "../../components/Button"; import Card from "../../components/Card"; +import { usePageTitle } from "../../hooks"; export default function Donate() { + usePageTitle("Support us"); + return ( <>
diff --git a/apps/website/src/pages/Download/download.tsx b/apps/website/src/pages/Download/download.tsx index 8b5450cce..560ce1bbe 100644 --- a/apps/website/src/pages/Download/download.tsx +++ b/apps/website/src/pages/Download/download.tsx @@ -3,9 +3,11 @@ import Card from "../../components/Card"; import Section from "../../components/Section"; import { App, Architecture, buildDownloadUrl, downloadMatrix, DownloadMatrixEntry, getArchitecture, Platform } from "../../download-helper"; import "./download.css"; +import { usePageTitle } from "../../hooks"; export default function DownloadPage() { const [ currentArch, setCurrentArch ] = useState(getArchitecture()); + usePageTitle("Download"); return ( <> diff --git a/apps/website/src/pages/Home/index.tsx b/apps/website/src/pages/Home/index.tsx index 638c1107a..fb5b5b7c4 100644 --- a/apps/website/src/pages/Home/index.tsx +++ b/apps/website/src/pages/Home/index.tsx @@ -3,8 +3,11 @@ import Card from '../../components/Card'; import Section from '../../components/Section'; import DownloadButton from '../../components/DownloadButton'; import "./index.css"; +import { usePageTitle } from '../../hooks'; export function Home() { + usePageTitle(""); + return ( <> diff --git a/apps/website/src/pages/_404.tsx b/apps/website/src/pages/_404.tsx index 7cd7e4e5c..df2ca7458 100644 --- a/apps/website/src/pages/_404.tsx +++ b/apps/website/src/pages/_404.tsx @@ -1,7 +1,10 @@ import Section from "../components/Section"; +import { usePageTitle } from "../hooks"; import "./_404.css"; export function NotFound() { + usePageTitle("404"); + return (
The page you were looking for could not be found. Maybe it was deleted or the URL is incorrect.