diff --git a/web/index.html b/web/index.html index af50390..0780ae9 100644 --- a/web/index.html +++ b/web/index.html @@ -1,10 +1,22 @@ - + - + + - andrea-slop-fotografie + + Lifestyle fotograaf in Huizen | Andrea Slop Fotografie + + + + + +
diff --git a/web/public/favicon.png b/web/public/favicon.png new file mode 100644 index 0000000..18d070a Binary files /dev/null and b/web/public/favicon.png differ diff --git a/web/public/favicon.svg b/web/public/favicon.svg deleted file mode 100644 index 6893eb1..0000000 --- a/web/public/favicon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/web/src/main.tsx b/web/src/main.tsx index e7b32ad..ecb08fb 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -21,6 +21,10 @@ declare module '@tanstack/react-router' { } } +// De statische head-tags uit index.html zijn alleen voor crawlers zonder +// JavaScript. Vanaf hier beheren de routes ze, dus voorkom dubbele tags. +document.querySelectorAll('head [data-fallback]').forEach((el) => el.remove()); + // Render the app const rootElement = document.getElementById('root')!; if (!rootElement.innerHTML) { diff --git a/web/src/routes/__root.tsx b/web/src/routes/__root.tsx index 265773b..6cb15db 100644 --- a/web/src/routes/__root.tsx +++ b/web/src/routes/__root.tsx @@ -1,12 +1,18 @@ -import { createRootRoute } from '@tanstack/react-router'; +import { createRootRoute, HeadContent } from '@tanstack/react-router'; import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'; import AppShell from '../components/AppShell'; +import { siteHead } from '../seo'; const RootLayout = () => ( <> + {/* Titel en meta-tags van de actieve route; React zet ze in */} + ); -export const Route = createRootRoute({ component: RootLayout }); +export const Route = createRootRoute({ + head: () => siteHead, + component: RootLayout, +}); diff --git a/web/src/routes/index.tsx b/web/src/routes/index.tsx index 2ab18bc..aa85ad4 100644 --- a/web/src/routes/index.tsx +++ b/web/src/routes/index.tsx @@ -1,8 +1,15 @@ import { createFileRoute } from '@tanstack/react-router'; import Hero from '../components/Hero/Hero'; import heroContent from '../components/Hero/heroContent'; +import { pageHead } from '../seo'; export const Route = createFileRoute('/')({ + head: () => + pageHead({ + title: 'Lifestyle fotograaf in Huizen | Andrea Slop Fotografie', + description: + "Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots.", + }), component: Index, }); diff --git a/web/src/routes/over-mij.tsx b/web/src/routes/over-mij.tsx index 1f71f8c..63e5816 100644 --- a/web/src/routes/over-mij.tsx +++ b/web/src/routes/over-mij.tsx @@ -1,6 +1,13 @@ import { createFileRoute } from "@tanstack/react-router"; +import { pageHead } from "../seo"; export const Route = createFileRoute("/over-mij")({ + head: () => + pageHead({ + title: "Over mij | Andrea Slop Fotografie", + description: + "Hi! Ik ben Andrea, lifestyle fotograaf uit Huizen. Ik leg jullie vast zoals jullie zijn: spontaan en natuurlijk, zonder ongemakkelijke poses.", + }), component: About, }); diff --git a/web/src/seo.ts b/web/src/seo.ts new file mode 100644 index 0000000..4e64048 --- /dev/null +++ b/web/src/seo.ts @@ -0,0 +1,31 @@ +// Head-tags per pagina, voor de `head`-optie van een route. Titel en +// beschrijving komen later uit het CMS. +// +// Richtlijn: titel max. ~60 tekens, beschrijving max. ~155 tekens; daarna +// kort Google ze af in de zoekresultaten. +export function pageHead({ + title, + description, +}: { + title: string; + description: string; +}) { + return { + meta: [ + { title }, + { name: 'description', content: description }, + // Voor link-previews (WhatsApp, Facebook, LinkedIn) + { property: 'og:title', content: title }, + { property: 'og:description', content: description }, + ], + }; +} + +// Tags die voor de hele site gelden +export const siteHead = { + meta: [ + { property: 'og:site_name', content: 'Andrea Slop Fotografie' }, + { property: 'og:locale', content: 'nl_NL' }, + { property: 'og:type', content: 'website' }, + ], +};