www/components/meta.tsx

24 lines
521 B
TypeScript
Raw Normal View History

2021-12-07 22:38:31 -05:00
import Head from 'next/head';
2022-04-27 21:55:18 -04:00
function Meta({name, ancestors}
: {name: string, ancestors?: Array<{ name: string, path: string }> }) {
2022-10-04 23:41:59 -04:00
function path(): string {
2022-04-27 21:55:18 -04:00
if (!ancestors)
return name;
2021-12-07 22:38:31 -05:00
let path = '';
2022-05-15 09:56:45 -04:00
ancestors.forEach((obj) => {
2021-12-07 22:38:31 -05:00
path = `${path}${obj.name} /`;
});
2022-10-04 23:41:59 -04:00
return `PaulW.XYZ / ${path} ${name}`;
}
2021-12-07 22:38:31 -05:00
return (
<Head>
2022-10-04 23:41:59 -04:00
<title>{path()}</title>
2021-12-07 22:38:31 -05:00
</Head>
);
2022-04-27 21:55:18 -04:00
}
export default Meta;