mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-05 22:51:51 +09:00
Introduces a Site Settings tab in the Settings page for admins to toggle user registration. Adds dynamic page title updates based on route, updates the favicon and meta tags, and conditionally shows the registration link on the login page based on the registration setting. Also adds a reusable usePageTitle hook.
19 lines
460 B
JavaScript
19 lines
460 B
JavaScript
import { useEffect } from 'react';
|
|
|
|
/**
|
|
* Hook to set the page title
|
|
* @param {string} title - The page title (will be appended with " | ServerKit")
|
|
*/
|
|
export function usePageTitle(title) {
|
|
useEffect(() => {
|
|
const previousTitle = document.title;
|
|
document.title = title ? `${title} | ServerKit` : 'ServerKit';
|
|
|
|
return () => {
|
|
document.title = previousTitle;
|
|
};
|
|
}, [title]);
|
|
}
|
|
|
|
export default usePageTitle;
|