Skip to content

Commit

Permalink
fix: overriding existing default meta (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: Kezhik Kyzyl-ool <[email protected]>
Co-authored-by: Valerii Sidorenko <[email protected]>
  • Loading branch information
3 people authored Feb 27, 2024
1 parent 1682866 commit e68011e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ export function generateRenderContent<Plugins extends Plugin[], Data>(
): RenderContent {
const helpers = getRenderHelpers(params);
const htmlAttributes: Record<string, string> = {};
const meta = [...defaultMeta, ...(params.meta ?? [])];
const meta = params.meta ?? [];
// in terms of sets: meta = params.meta ∪ (defaultMeta ∖ params.meta)
defaultMeta.forEach((defaultMetaItem) => {
if (!meta.find(({name}) => name === defaultMetaItem.name)) {
meta.push(defaultMetaItem);
}
});
const styleSheets = params.styleSheets || [];
const scripts = params.scripts || [];
const inlineStyleSheets = params.inlineStyleSheets || [];
Expand Down

0 comments on commit e68011e

Please sign in to comment.