@cntrl-site/sdk-nextjs 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,16 +18,17 @@ const CNTRLHead = ({ meta, project }) => {
18
18
  const customFonts = project.fonts.custom;
19
19
  const htmlHead = (0, html_react_parser_1.default)(project.html.head);
20
20
  const ffGenerator = new sdk_1.FontFaceGenerator(customFonts);
21
+ const links = Object.values(parsedFonts).map((value, i) => {
22
+ if (!value)
23
+ return;
24
+ const rel = value?.rel || value.props?.rel;
25
+ const href = value?.href || value.props?.href;
26
+ if (!rel || !href)
27
+ return;
28
+ return ((0, jsx_runtime_1.jsx)("link", { rel: rel, href: href }, `link-${rel}-${href}`));
29
+ });
21
30
  return ((0, jsx_runtime_1.jsxs)(head_1.default, { children: [(0, jsx_runtime_1.jsx)("title", { children: meta.title }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: meta.description }), (0, jsx_runtime_1.jsx)("meta", { name: "keywords", content: meta.keywords }), (0, jsx_runtime_1.jsx)("meta", { property: "og:image", content: meta.opengraphThumbnail }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", href: meta.favicon }), customFonts.length > 0 && ((0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: {
22
31
  __html: ffGenerator.generate()
23
- } })), Object.values(parsedFonts).map((value, i) => {
24
- if (!value)
25
- return undefined;
26
- const rel = value?.rel || value.props?.rel;
27
- const href = value?.href || value.props?.href;
28
- if (!rel || !href)
29
- return undefined;
30
- return ((0, jsx_runtime_1.jsx)("link", { rel: rel, href: href }, i));
31
- }), htmlHead] }));
32
+ } })), links, htmlHead] }));
32
33
  };
33
34
  exports.CNTRLHead = CNTRLHead;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -18,6 +18,15 @@ export const CNTRLHead: FC<Props> = ({ meta, project }) => {
18
18
  const customFonts = project.fonts.custom;
19
19
  const htmlHead = HTMLReactParser(project.html.head);
20
20
  const ffGenerator = new FontFaceGenerator(customFonts);
21
+ const links = Object.values(parsedFonts as ReturnType<typeof domToReact>).map((value, i) => {
22
+ if (!value) return;
23
+ const rel = value?.rel || value.props?.rel;
24
+ const href = value?.href || value.props?.href;
25
+ if (!rel || !href) return;
26
+ return (
27
+ <link key={`link-${rel}-${href}`} rel={rel} href={href} />
28
+ );
29
+ });
21
30
  return (
22
31
  <Head>
23
32
  <title>{meta.title}</title>
@@ -32,15 +41,7 @@ export const CNTRLHead: FC<Props> = ({ meta, project }) => {
32
41
  }}
33
42
  />
34
43
  )}
35
- {Object.values(parsedFonts as ReturnType<typeof domToReact>).map((value, i) => {
36
- if (!value) return undefined;
37
- const rel = value?.rel || value.props?.rel;
38
- const href = value?.href || value.props?.href;
39
- if (!rel || !href) return undefined;
40
- return (
41
- <link key={i} rel={rel} href={href} />
42
- );
43
- })}
44
+ {links}
44
45
  {htmlHead}
45
46
 
46
47
  </Head>
Binary file
Binary file
Binary file