30
common/resources/client/seo/static-page-title.tsx
Executable file
30
common/resources/client/seo/static-page-title.tsx
Executable file
@@ -0,0 +1,30 @@
|
||||
import {Helmet} from './helmet';
|
||||
import {ReactElement} from 'react';
|
||||
import {MessageDescriptor} from '../i18n/message-descriptor';
|
||||
import {useSettings} from '../core/settings/use-settings';
|
||||
|
||||
type TitleChild =
|
||||
| string
|
||||
| null
|
||||
| ReactElement<MessageDescriptor>
|
||||
| MessageDescriptor;
|
||||
export type TitleMetaTagChildren = TitleChild | TitleChild[];
|
||||
|
||||
interface StaticPageTitleProps {
|
||||
children: TitleMetaTagChildren;
|
||||
}
|
||||
export function StaticPageTitle({children}: StaticPageTitleProps) {
|
||||
const {
|
||||
branding: {site_name},
|
||||
} = useSettings();
|
||||
return (
|
||||
<Helmet>
|
||||
{children ? (
|
||||
// @ts-ignore
|
||||
<title>
|
||||
{children as any} - {site_name}
|
||||
</title>
|
||||
) : undefined}
|
||||
</Helmet>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user