Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how we set page titles #677

Open
reefdog opened this issue Apr 10, 2024 · 0 comments
Open

Improve how we set page titles #677

reefdog opened this issue Apr 10, 2024 · 0 comments
Assignees

Comments

@reefdog
Copy link
Contributor

reefdog commented Apr 10, 2024

We could use a bit of DRYing up how we set document.title throughout the site. All over the place you'll see things like:

useEffect(() => {
	document.title = 'Some page name - Philanthropy Data Commons';

	return () => {
		document.title = 'Philanthropy Data Commons';
	};
}, []);

This is using useEffect (the safe place to make DOM edits) to set the document.title on page/component load, then returning an unmount method to restore its former glory.

This should really be something more like setTitle('Some page name') and then resetTitle() at the end.

@reefdog reefdog self-assigned this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant