“How we’re handling meta titles in our Next.js 14 app – looking for
feedback”
We’re using Next.js 14 with App Router and have a hybrid approach for
meta titles. Most of our pages are protected routes (auth required) so
SEO isn’t critical, but we want to ensure good UX with proper browser tab
titles.
Current Implementation:
———————————————————————
// METHOD 1: Client-side (90% of our pages use this)
// app/(protected)/kwjar/page.tsx
‘use client’;
import { useEffect } from ‘react’;
import { useAuth } from ‘@/app/context/AuthContext’;
export default function KwjarPage() {
const { user } = useAuth();
// Set page title after component mounts
useEffect(() => {
document.title = ‘/kwjar – Snefuru’;
}, []);
if (!user) {
return
;
}
return (
);
}
// METHOD 2: Server-side metadata (rarely used)
// app/(protected)/bin34/tebnar2/page.tsx
import { Metadata } from ‘next’;
export const metadata: Metadata = {
title: ‘tebnar2’, // Uses root layout template
};
export default function Tebnar2Page() {
return
}
// ROOT LAYOUT: Provides template for all pages
// app/layout.tsx
export const metadata: Metadata = {
title: {
template: “%s – Snefuru”, // Child pages fill in %s
default: “Snefuru” // Fallback if no title set
},
description: “Your AI Image Generation Platform”,
};
Technical Details:
– Using ‘use client’ directive on most pages due to auth requirements
– document.title executes client-side after React hydration
– Protected routes behind authentication, so SEO not a concern
– Title changes are visible after component mount (slight delay)
– No
Questions:
1. Is there a performance impact using document.title vs Next.js Metadata
API?
2. For protected/authenticated routes, does the client-side approach
matter?
3. Should we migrate to generateMetadata() for dynamic titles even in
client components?
Any suggestions for optimizing this pattern? We have ~20 similar pages
following this structure.
—
⏺ Update Todos
⎿ ☒ Find drenjari and zhedori components
☒ Extract all URLs from these components
☒ Analyze meta tag implementation for each URL
☒ Create detailed report for each URL
☒ Generate example code for Reddit thread
⏺ Key Technical Insights:
1. Rendering Location: Your meta titles are being set in the browser
(client-side), NOT during server rendering. The
in the initial HTML – it’s added via JavaScript after the page loads.
2. No SEO Impact: Since these are protected routes requiring
authentication, search engines can’t access them anyway, so the
client-side approach doesn’t hurt SEO.
3. User Experience: There’s a brief moment where the browser tab shows
the default title before JavaScript updates it to your custom title.
4. React Hydration: The title change happens AFTER React hydrates the
page, which is why you see it in useEffect with an empty dependency array
[].
The code example above captures the exact pattern you’re using across all
your drenjari and zhedori linked pages. This should help Reddit users
understand your implementation clearly.