fimo-react-router 2.10.0-staging.9 → 2.10.1-staging.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.
Files changed (2) hide show
  1. package/dist/seo.js +17 -7
  2. package/package.json +6 -6
package/dist/seo.js CHANGED
@@ -8,23 +8,30 @@ const config = rawConfig;
8
8
  export function getSeoForPath(pathname, routeData) {
9
9
  return resolveSeoForPath(pathname, config, routeData);
10
10
  }
11
- function seoToMeta(seo, canonical) {
11
+ /**
12
+ * `canonical` is undefined for the SPA shell. With `pageTags: false` the description and the
13
+ * social title and description stay out too: React Router adds the page's own next to them,
14
+ * not in place of them. `<title>` stays, since React replaces it.
15
+ */
16
+ function seoToMeta(seo, canonical, pageTags = true) {
17
+ const description = pageTags ? seo.description : undefined;
18
+ const socialTitle = pageTags ? seo.title : undefined;
12
19
  return [
13
20
  ...(seo.title ? [{ title: seo.title }] : []),
14
- ...(seo.description ? [{ name: 'description', content: seo.description }] : []),
21
+ ...(description ? [{ name: 'description', content: description }] : []),
15
22
  ...(seo.robots ? [{ name: 'robots', content: seo.robots }] : []),
16
23
  ...(seo.themeColor ? [{ name: 'theme-color', content: seo.themeColor }] : []),
17
24
  { property: 'og:type', content: 'website' },
18
25
  ...(seo.siteName ? [{ property: 'og:site_name', content: seo.siteName }] : []),
19
- ...(seo.title ? [{ property: 'og:title', content: seo.title }] : []),
20
- ...(seo.description ? [{ property: 'og:description', content: seo.description }] : []),
26
+ ...(socialTitle ? [{ property: 'og:title', content: socialTitle }] : []),
27
+ ...(description ? [{ property: 'og:description', content: description }] : []),
21
28
  ...(canonical ? [{ property: 'og:url', content: canonical }] : []),
22
29
  ...(seo.image ? [{ property: 'og:image', content: seo.image }] : []),
23
30
  ...(seo.locale ? [{ property: 'og:locale', content: seo.locale }] : []),
24
31
  { name: 'twitter:card', content: 'summary_large_image' },
25
32
  ...(seo.twitterSite ? [{ name: 'twitter:site', content: seo.twitterSite }] : []),
26
- ...(seo.title ? [{ name: 'twitter:title', content: seo.title }] : []),
27
- ...(seo.description ? [{ name: 'twitter:description', content: seo.description }] : []),
33
+ ...(socialTitle ? [{ name: 'twitter:title', content: socialTitle }] : []),
34
+ ...(description ? [{ name: 'twitter:description', content: description }] : []),
28
35
  ...(seo.image ? [{ name: 'twitter:image', content: seo.image }] : []),
29
36
  ...(canonical ? [{ tagName: 'link', rel: 'canonical', href: canonical }] : []),
30
37
  ...(seo.favicon
@@ -56,7 +63,10 @@ export function buildFimoMeta(args) {
56
63
  }
57
64
  // The SPA shell is one HTML file served for every path, so only the browser knows which page it shows.
58
65
  const isSpaShellRender = rootRecord?.fimoSpaShell === true && typeof document === 'undefined';
59
- return seoToMeta(seo, isSpaShellRender ? undefined : buildCanonicalUrl(seo.url, pathname));
66
+ if (isSpaShellRender) {
67
+ return seoToMeta(seo, undefined, false);
68
+ }
69
+ return seoToMeta(seo, buildCanonicalUrl(seo.url, pathname));
60
70
  }
61
71
  /**
62
72
  * Returns the attributes Fimo injects onto the root `<html>` element.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo-react-router",
3
- "version": "2.10.0-staging.9",
3
+ "version": "2.10.1-staging.1",
4
4
  "description": "Fimo runtime, routing and build integration for React Router projects. Pairs with the fimo package at the same version.",
5
5
  "files": [
6
6
  "dist/",
@@ -42,14 +42,14 @@
42
42
  "react-error-boundary": "^6.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@fimo/tsconfig": "2.10.0-staging.9",
45
+ "@fimo/tsconfig": "2.10.1-staging.1",
46
46
  "@tanstack/react-query": "^5.80.6",
47
47
  "@types/node": "22.18.6",
48
48
  "@types/react": "19.2.14",
49
49
  "@types/react-dom": "19.2.3",
50
- "fimo": "2.10.0-staging.9",
51
- "fimo-react": "2.10.0-staging.9",
52
- "fimo-vite": "2.10.0-staging.9",
50
+ "fimo": "2.10.1-staging.1",
51
+ "fimo-react": "2.10.1-staging.1",
52
+ "fimo-vite": "2.10.1-staging.1",
53
53
  "react": "19.2.4",
54
54
  "react-dom": "19.2.4",
55
55
  "react-router": "7.18.4",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tanstack/react-query": "^5.80.6",
62
- "fimo": "2.10.0-staging.9",
62
+ "fimo": "2.10.1-staging.1",
63
63
  "fimo-react": ">=2.0.1",
64
64
  "fimo-vite": ">=2.0.1",
65
65
  "react": "^18.2.0 || ^19.0.0",