@modern-js/main-doc 3.1.3 → 3.1.5

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/package.json +3 -2
  2. package/rspress.config.ts +45 -26
package/package.json CHANGED
@@ -16,16 +16,17 @@
16
16
  "modern",
17
17
  "modern.js"
18
18
  ],
19
- "version": "3.1.3",
19
+ "version": "3.1.5",
20
20
  "publishConfig": {
21
21
  "registry": "https://registry.npmjs.org/",
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
25
  "mermaid": "^11.12.3",
26
- "@modern-js/sandpack-react": "3.1.3"
26
+ "@modern-js/sandpack-react": "3.1.5"
27
27
  },
28
28
  "devDependencies": {
29
+ "rsbuild-plugin-open-graph": "1.1.2",
29
30
  "@rsbuild/plugin-sass": "1.5.0",
30
31
  "@rspress/core": "2.0.2",
31
32
  "@rspress/plugin-llms": "2.0.2",
package/rspress.config.ts CHANGED
@@ -2,15 +2,22 @@ import path from 'path';
2
2
  import { pluginSass } from '@rsbuild/plugin-sass';
3
3
  import { defineConfig } from '@rspress/core';
4
4
  import { transformerNotationHighlight } from '@shikijs/transformers';
5
+ import { pluginOpenGraph } from 'rsbuild-plugin-open-graph';
5
6
 
6
7
  const docPath = path.join(__dirname, 'docs');
8
+ const siteTitle = 'Modern.js';
9
+ const siteDescription =
10
+ 'The Modern.js framework is a progressive web framework based on React. At ByteDance, we use Modern.js to build upper-level frameworks that have supported the development of thousands of web applications.';
11
+ const socialDescription =
12
+ 'A Progressive React Framework for modern web development.';
13
+ const socialImage =
14
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/banner.jpeg';
7
15
 
8
16
  export default defineConfig({
9
17
  root: docPath,
10
18
  llms: true,
11
- title: 'Modern.js',
12
- description:
13
- 'The Modern.js framework is a progressive web framework based on React. At ByteDance, we use Modern.js to build upper-level frameworks that have supported the development of thousands of web applications.',
19
+ title: siteTitle,
20
+ description: siteDescription,
14
21
  base: '/',
15
22
  logo: 'https://lf-cdn-tos.bytescm.com/obj/static/webinfra/modern-js-website/assets/images/images/modernjs-logo.svg',
16
23
  icon: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico',
@@ -25,37 +32,33 @@ export default defineConfig({
25
32
  search: {
26
33
  codeBlocks: true,
27
34
  },
28
- head: [
29
- `
30
- <script>
31
- ;(function (w, d, u, b, n, pc, ga, ae, po, s, p, e, t, pp) {pc = 'precollect';ga = 'getAttribute';ae = 'addEventListener';po = 'PerformanceObserver';s = function (m) {p = [].slice.call(arguments);p.push(Date.now(), location.href);(m == pc ? s.p.a : s.q).push(p)};s.q = [];s.p = { a: [] };w[n] = s;e = document.createElement('script');e.src = u + '?bid=' + b + '&globalName=' + n;e.crossorigin = u.indexOf('sdk-web') > 0 ? 'anonymous' : 'use-credentials';d.getElementsByTagName('head')[0].appendChild(e);if (ae in w) {s.pcErr = function (e) {e = e || w.event;t = e.target || e.srcElement;if (t instanceof Element || t instanceof HTMLElement) {if (t[ga]('integrity')) {w[n](pc, 'sri', t[ga]('href') || t[ga]('src'))} else {w[n](pc, 'st', { tagName: t.tagName, url: t[ga]('href') || t[ga]('src') })}} else {w[n](pc, 'err', e.error)}};s.pcRej = function (e) {e = e || w.event;w[n](pc, 'err', e.reason || (e.detail && e.detail.reason))};w[ae]('error', s.pcErr, true);w[ae]('unhandledrejection', s.pcRej, true);};if('PerformanceLongTaskTiming' in w) {pp = s.pp = { entries: [] };pp.observer = new PerformanceObserver(function (l) {pp.entries = pp.entries.concat(l.getEntries)});pp.observer.observe({ entryTypes: ['longtask', 'largest-contentful-paint','layout-shift'] })}})(window,document,'https://lf3-short.bytegoofy.com/slardar/fe/sdk-web/browser.cn.js','modernjs_dev','Slardar');
32
-
33
- </script>
34
- `,
35
- `
36
- <script>
37
- window.Slardar('init', {
38
- bid: 'modernjs_dev'
39
- });
40
- window.Slardar('start')
41
- </script>
42
- `,
43
- ],
35
+ // head: [
36
+ // () => {
37
+ // return [
38
+ // `<meta property="og:image" content="${socialImage}">`,
39
+ // `<meta property="og:description" content="${socialDescription}">`,
40
+ // `<meta property="og:image:alt" content="${siteTitle}">`,
41
+ // `<meta name="twitter:card" content="summary_large_image">`,
42
+ // `<meta name="twitter:title" content="${siteTitle}">`,
43
+ // `<meta name="twitter:description" content="${socialDescription}">`,
44
+ // `<meta name="twitter:image" content="${socialImage}">`,
45
+ // `<meta name="twitter:image:alt" content="${siteTitle}">`,
46
+ // ].join('');
47
+ // },
48
+ // ],
44
49
  themeConfig: {
45
50
  locales: [
46
51
  {
47
52
  lang: 'zh',
48
- title: 'Modern.js',
49
- description:
50
- 'A Progressive React Framework for modern web development.',
53
+ title: siteTitle,
54
+ description: socialDescription,
51
55
  // nav: getNavbar('zh'),
52
56
  label: '简体中文',
53
57
  },
54
58
  {
55
59
  lang: 'en',
56
- title: 'Modern.js',
57
- description:
58
- 'A Progressive React Framework for modern web development.',
60
+ title: siteTitle,
61
+ description: socialDescription,
59
62
  // nav: getNavbar('en'),
60
63
  label: 'English',
61
64
  },
@@ -118,6 +121,22 @@ export default defineConfig({
118
121
  '@site': require('path').resolve(__dirname),
119
122
  },
120
123
  },
121
- plugins: [pluginSass()],
124
+ plugins: [
125
+ pluginSass(),
126
+ pluginOpenGraph({
127
+ // Note, title is page-specific
128
+ title: 'Modern.js Home Page',
129
+ // While site name is site wide
130
+ siteName: siteTitle,
131
+ type: 'website',
132
+ url: 'https://modernjs.dev/',
133
+ image: socialImage,
134
+ description: socialDescription,
135
+ twitter: {
136
+ site: '@_Modern_JS',
137
+ card: 'summary_large_image',
138
+ },
139
+ }),
140
+ ],
122
141
  },
123
142
  });