Skip to content

Build your personal knowledge base with Trilium Notes

feat(website): adjust page title

Elian Doran4e4e65b462be
diff --git a/apps/website/src/hooks.tsx b/apps/website/src/hooks.tsx
new file mode 100644
index 0000000000..a5d061c74a
--- /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 6299092471..e8a33763b4 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 (
<>
<Section title="Support us" className="donate fill">
diff --git a/apps/website/src/pages/Download/download.tsx b/apps/website/src/pages/Download/download.tsx
index 8b5450ccea..560ce1bbef 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 638c1107a2..fb5b5b7c43 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 (
<>
<HeroSection />
diff --git a/apps/website/src/pages/_404.tsx b/apps/website/src/pages/_404.tsx
index 7cd7e4e5cc..df2ca74586 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 (
<Section title="404: Not Found" className="section-404">
The page you were looking for could not be found. Maybe it was deleted or the URL is incorrect.