www/components/meta.tsx
2022-10-04 23:41:59 -04:00

24 lines
521 B
TypeScript

import Head from 'next/head';
function Meta({name, ancestors}
: {name: string, ancestors?: Array<{ name: string, path: string }> }) {
function path(): string {
if (!ancestors)
return name;
let path = '';
ancestors.forEach((obj) => {
path = `${path}${obj.name} /`;
});
return `PaulW.XYZ / ${path} ${name}`;
}
return (
<Head>
<title>{path()}</title>
</Head>
);
}
export default Meta;