{"id":52644,"date":"2024-12-03T12:31:26","date_gmt":"2024-12-03T04:31:26","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52644\/"},"modified":"2024-12-03T12:31:26","modified_gmt":"2024-12-03T04:31:26","slug":"%e4%bc%9f%e5%a4%a7%e7%9a%84%e9%a2%84%e6%b8%b2%e6%9f%93%e4%bb%bb%e5%8a%a1-arin-%e5%af%bb%e6%b1%82%e8%87%aa%e5%ae%9a%e4%b9%89-ssr-%e5%92%8c-ssg-%e6%8e%8c%e6%8f%a1","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52644\/","title":{"rendered":"\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p>\u73cd\u60dc\u65f6\u95f4\uff0c\u52e4\u594b\u5b66\u4e60\uff01\u4eca\u5929\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1\u300b<\/span>\uff0c\u6b63\u6587\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\uff0c\u6216\u8005\u662f\u5bf9<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u6709\u7591\u95ee\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u6211\uff01\u540e\u9762\u6211\u4f1a\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u5185\u5bb9\u7684\uff0c\u5e0c\u671b\u90fd\u80fd\u5e2e\u5230\u6b63\u5728\u5b66\u4e60\u7684\u5927\u5bb6\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241122\/1732248768674004c01817a.jpg\" class=\"aligncenter\" title=\"\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1\u63d2\u56fe\" alt=\"\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1\u63d2\u56fe\" \/><\/p>\n<h3> <strong>\u7b2c 10 \u96c6\uff1a\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1 \u2013 arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 ssr \u548c ssg \u7cbe\u901a<\/strong> <\/h3>\n<hr>\n<p><strong>\u6cd5\u5178\u9759\u6001\u5e93<\/strong>\u95ea\u70c1\u7740\u5b89\u9759\u7684\u671f\u5f85\u3002\u8fd9\u4e9b\u91d1\u5e93\u662f\u77e5\u8bc6\u7684\u6c89\u9ed8\u5b88\u62a4\u8005\uff0c\u5b83\u4eec\u7684\u5899\u58c1\u4e0a\u6392\u5217\u7740\u6570\u636e\u5377\u8f74\u548c\u53d1\u5149\u7684\u9875\u9762\uff0c\u7b49\u5f85\u7740\u7528\u6237\u7684\u53ec\u5524\u3002\u4eca\u5929\uff0carin \u7ad9\u5728\u8fd9\u4e9b\u91d1\u5e93\u7684\u95e8\u53e3\uff0c\u80a9\u8d1f\u7740\u638c\u63e1\u4e00\u9879\u65b0\u7684\u91cd\u8981\u5de5\u827a\u7684\u4efb\u52a1\uff1a\u521b\u5efa\u9759\u6001\u9884\u6e32\u67d3\u9875\u9762\uff0c\u5e2e\u52a9 codex \u6bd4\u4ee5\u5f80\u66f4\u5feb\u5730\u4e3a\u7528\u6237\u670d\u52a1\u3002<\/p>\n<p><strong>\u201c\u963f\u6797\u201d<\/strong>\u751f\u547d\u5468\u671f\u961f\u957f\u7684\u58f0\u97f3\u5728\u62f1\u5f62\u623f\u95f4\u91cc\u56de\u54cd\uff0c\u5438\u5f15\u4e86\u5979\u7684\u6ce8\u610f\u529b\u3002 <strong>\u201c\u4eca\u5929\uff0c\u60a8\u5c06\u5b66\u4e60\u5982\u4f55\u5229\u7528\u9759\u6001\u6e32\u67d3\u7684\u529b\u91cf\u3002\u8fd9\u4e0d\u4ec5\u4ec5\u662f\u77e5\u8bc6\u7684\u95ee\u9898\uff0c\u800c\u662f\u5728\u7528\u6237\u7684\u9700\u6c42\u51fa\u73b0\u4e4b\u524d\u5c31\u51c6\u5907\u597d codex \u6765\u6ee1\u8db3\u7528\u6237\u7684\u9700\u6c42\u3002\u201d<\/strong><\/p>\n<p>\u8fd9\u5bf9\u771f\u6b63\u7684\u9632\u5b88\u8005\u6765\u8bf4\u662f\u4e00\u4e2a\u503c\u5f97\u6311\u6218\u7684\u6311\u6218\uff0c\u963f\u6797\u5fc3\u60f3\uff0c\u5979\u7684\u773c\u775b\u91cc\u95ea\u70c1\u7740\u575a\u5b9a\u7684\u5149\u8292\u3002\u662f\u65f6\u5019\u6253\u9020\u4e00\u4e2a\u7cfb\u7edf\uff0c\u5141\u8bb8 codex \u9884\u6e32\u67d3\u5176\u9875\u9762\uff0c\u786e\u4fdd\u5728\u8c03\u7528\u65f6\u7acb\u5373\u54cd\u5e94\u3002<\/p>\n<hr>\n<h3> <strong>1.\u5236\u4f5c\u6863\u6848 \u2013 \u4f7f\u7528 mdx \u6784\u5efa\u81ea\u5b9a\u4e49 ssg<\/strong> <\/h3>\n<p>\u751f\u547d\u5468\u671f\u961f\u957f\u4e0e\u963f\u6797\u5e76\u80a9\u8d70\u5165\u907f\u96be\u6240\u7684\u6df1\u5904\u3002\u7528\u6570\u636e\u7167\u4eae\u7684\u5377\u8f74\uff0c\u63ed\u793a\u4e86\u65e9\u5728\u7528\u6237\u9700\u8981\u5b83\u4eec\u4e4b\u524d\u5c31\u5df2\u6e32\u67d3\u7684\u811a\u672c\u548c\u9875\u9762\u3002 <strong>\u201c\u4e3a\u4e86\u51c6\u5907\u6cd5\u5178\uff0c\u6211\u4eec\u5fc5\u987b\u5b66\u4f1a\u6355\u6349\u77e5\u8bc6\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u8fd9\u4e9b\u9875\u9762\u4e2d\uff0c\u201d<\/strong>\u4ed6\u8bf4\u3002<\/p>\n<p>arin \u7684\u4efb\u52a1\u5f88\u660e\u786e\uff1a\u4e3a codex \u7684\u535a\u5ba2\u6784\u5efa\u9759\u6001\u7ad9\u70b9\u751f\u6210 (ssg) \u7cfb\u7edf\uff0c\u53ef\u4ee5\u968f\u65f6\u8c03\u7528\u8fc7\u53bb\u7684\u6545\u4e8b\u548c\u6559\u8bad\u3002<\/p>\n<p><strong>\u7b2c 1 \u6b65\uff1a\u6536\u96c6\u5de5\u5177<\/strong><br \/> \u7b2c\u4e00\u6b65\u662f\u4e3a codex \u914d\u5907\u8bfb\u53d6\u548c\u7f16\u8bd1\u5176\u5377\u8f74\u7684\u65b9\u6cd5 &#8211; mdx \u6587\u4ef6\u3002<\/p>\n<pre>npm install fs-extra react react-dom react-dom\/server @mdx-js\/react @mdx-js\/mdx\n<\/pre>\n<p>\u5f53\u963f\u6797\u542f\u52a8\u7ec4\u4ef6\u65f6\uff0c\u623f\u95f4\u91cc\u53d1\u51fa\u8f7b\u67d4\u7684\u55e1\u55e1\u58f0\u3002\u6bcf\u4e2a\u88c5\u7f6e\u90fd\u50cf\u4e00\u4e2a\u7b26\u6587\u8680\u523b\u5728\u91d1\u5e93\u7684\u57fa\u7840\u8bbe\u65bd\u4e2d\uff0c\u4e3a\u89e3\u91ca\u548c\u5448\u73b0\u53e4\u4ee3\u6587\u672c\u505a\u597d\u51c6\u5907\u3002<\/p>\n<p><strong>\u7b2c 2 \u6b65\uff1a\u7f16\u5199\u7b2c\u4e00\u4e2a mdx \u5377\u8f74<\/strong><br \/> arin \u62ff\u8d77\u4e00\u652f\u7fbd\u6bdb\u7b14\uff0c\u5f00\u59cb\u64b0\u5199 codex \u7684\u7b2c\u4e00\u4e2a\u535a\u5ba2\uff0c\u8bb2\u8ff0\u5176\u5386\u53f2\u4e0e\u4ea4\u4e92\u5f0f react \u7ec4\u4ef6\u7684\u6545\u4e8b\u3002<\/p>\n<pre>\/\/ blogs\/hello-world.mdx\n# hello, world!\n\nwelcome to codex\u2019s first blog post. this content is rendered from an mdx file, combining the simplicity of markdown with the power of react components.\n\n&lt;specialnote&gt;this is a special react component embedded within mdx!&lt;\/specialnote&gt;\n<\/pre>\n<p>\u6bcf\u7b14\u5212\u8fc7\uff0c\u9875\u9762\u90fd\u4f1a\u53d1\u5149\uff0c\u5176\u5185\u5bb9\u73b0\u5728\u662f\u7b80\u5355\u6587\u672c\u548c\u590d\u6742\u7ec4\u4ef6\u7684\u6df7\u5408\u4f53\u3002<\/p>\n<p><strong>\u7b2c 3 \u6b65\uff1a\u521b\u5efa\u6e32\u67d3\u5377\u8f74\u7684\u811a\u672c<\/strong><br \/> arin \u5236\u4f5c\u4e86\u4e00\u4e2a\u5492\u8bed\u2014\u2014\u4e00\u4e2a\u811a\u672c\u2014\u2014\u53ef\u4ee5\u8bfb\u53d6\u5377\u8f74\uff0c\u5c06\u5b83\u4eec\u7f16\u8bd1\u6210 react \u7ec4\u4ef6\uff0c\u5e76\u5c06\u5b83\u4eec\u6e32\u67d3\u4e3a\u9759\u6001 html\u3002<\/p>\n<pre>\/\/ generatestaticblogs.js\nconst fs = require('fs-extra');\nconst path = require('path');\nconst react = require('react');\nconst reactdomserver = require('react-dom\/server');\nconst { mdxprovider } = require('@mdx-js\/react');\nconst mdx = require('@mdx-js\/mdx');\n\nconst outputpath = '.\/static-blogs';\nconst blogpath = '.\/blogs';\n\n(async () =&gt; {\n  try {\n    \/\/ ensure the output directory exists\n    await fs.ensuredir(outputpath);\n\n    const blogfiles = await fs.readdir(blogpath);\n    for (const file of blogfiles) {\n      if (path.extname(file) === '.mdx') {\n        const filepath = path.join(blogpath, file);\n        const content = await fs.readfile(filepath, 'utf8');\n        const compiledmdx = await mdx(content);\n        const component = new function('react', compiledmdx)(react);\n\n        \/\/ render the component to a static html string\n        const renderedblog = reactdomserver.rendertostring(\n          &lt;mdxprovider&gt;\n            &lt;component \/&gt;\n          &lt;\/mdxprovider&gt;\n        );\n\n        const htmltemplate = `\n          &lt;!doctype html&gt;\n          &lt;html lang=\"en\"&gt;\n            &lt;head&gt;\n              &lt;meta charset=\"utf-8\" \/&gt;\n              &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/&gt;\n              &lt;title&gt;${path.basename(file, '.mdx')}&lt;\/title&gt;\n            &lt;\/head&gt;\n            &lt;body&gt;\n              &lt;div id=\"root\"&gt;${renderedblog}&lt;\/div&gt;\n            &lt;\/body&gt;\n          &lt;\/html&gt;\n        `;\n\n        \/\/ write the rendered html to a file\n        await fs.writefile(`${outputpath}\/${path.basename(file, '.mdx')}.html`, htmltemplate);\n        console.log(`static blog page for ${file} generated successfully!`);\n      }\n    }\n  } catch (error) {\n    console.error('error generating static blogs:', error);\n  }\n})();\n<\/pre>\n<p><strong>\u7b2c\u56db\u6b65\uff1a\u8fd0\u884c\u5492\u8bed<\/strong><br \/> \u963f\u6797\u4f4e\u58f0\u5ff5\u51fa\u5492\u6587\u6765\u8c03\u7528\u811a\u672c\u3002<\/p>\n<pre>node generatestaticblogs.js\n<\/pre>\n<p>\u5979\u770b\u7740\u9759\u6001\u5e93\u53d8\u5f97\u6829\u6829\u5982\u751f\uff0c\u6bcf\u4e2a\u535a\u5ba2\u90fd\u53d1\u51fa\u67d4\u548c\u7684\u5149\u8292\uff0c\u56e0\u4e3a\u5b83\u8f6c\u53d8\u4e3a\u9759\u6001\u9875\u9762\uff0c\u51c6\u5907\u597d\u5411\u7528\u6237\u63d0\u4f9b\u670d\u52a1\u3002<\/p>\n<p><strong>\u963f\u6797\u7684\u5012\u5f71<\/strong>:<br \/><strong>\u201c\u8fd9\u4e9b\u9759\u6001\u9875\u9762\u4e0d\u4ec5\u4ec5\u662f\u56de\u58f0\uff0c\u201d<\/strong>\u5979\u4e00\u8fb9\u60f3\uff0c\u4e00\u8fb9\u770b\u7740\u91d1\u5e93\u95ea\u70c1\u7740\u77e5\u8bc6\u7684\u5149\u8292\u3002 <strong>\u201c\u5b83\u4eec\u662f codex \u51c6\u5907\u5c31\u7eea\u3001\u5373\u65f6\u4e14\u575a\u5b9a\u4e0d\u79fb\u7684\u670d\u52a1\u3002\u201d<\/strong><\/p>\n<hr>\n<h3> <strong>2.\u9759\u6001\u51c6\u5907\u7684\u4f18\u70b9\u548c\u7f3a\u70b9<\/strong> <\/h3>\n<p><strong>\u751f\u547d\u5468\u671f\u961f\u957f\u7684\u58f0\u97f3\u5212\u7834\u7a7a\u6c14\u3002<\/strong>\u201c\u8bb0\u4f4f\uff0carin\uff0c\u867d\u7136\u9759\u6001\u9875\u9762\u5f88\u5f3a\u5927\uff0c\u4f46\u5b83\u4eec\u4e5f\u6709\u81ea\u5df1\u7684\u6743\u8861\u3002\u201d<\/p>\n<p><strong>\u4f18\u70b9<\/strong>\uff1a<\/p>\n<ul>\n<li> <strong>\u6781\u5feb\u7684\u52a0\u8f7d\u65f6\u95f4<\/strong>\uff1a\u7acb\u5373\u63d0\u4f9b\u9884\u6e32\u67d3\u9875\u9762\uff0c\u7ed9\u7528\u6237\u5e26\u6765\u65e0\u7f1d\u901f\u5ea6\u7684\u9519\u89c9\u3002<\/li>\n<li> <strong>\u7cbe\u901a seo<\/strong>\uff1a\u5b8c\u5168\u6e32\u67d3\u7684 html \u53ef\u786e\u4fdd codex \u7684\u6545\u4e8b\u7d22\u5f15\u826f\u597d\uff0c\u83b7\u5f97\u53ef\u89c1\u6027\u3002<\/li>\n<li> <strong>\u5f00\u53d1\u4eba\u5458\u53cb\u597d<\/strong>\uff1amdx \u5141\u8bb8\u4e30\u5bcc\u7684 react \u7ec4\u4ef6\u4e0e markdown \u5e76\u5b58\uff0c\u5c06\u7b80\u5355\u6027\u4e0e\u4ea4\u4e92\u6027\u878d\u4e3a\u4e00\u4f53\u3002<\/li>\n<\/ul>\n<p><strong>\u7f3a\u70b9<\/strong>\uff1a<\/p>\n<ul>\n<li> <strong>\u91cd\u5efa<\/strong>\uff1a\u5fc5\u987b\u91cd\u5efa codex \u7684\u9875\u9762\u4ee5\u8fdb\u884c\u66f4\u65b0\uff0c\u8fd9\u4f7f\u5f97\u52a8\u6001\u5185\u5bb9\u66f4\u96be\u4ee5\u7ba1\u7406\u3002<\/li>\n<li> <strong>\u521d\u59cb\u6784\u5efa\u65f6\u95f4<\/strong>\uff1a\u751f\u6210\u5927\u578b\u5185\u5bb9\u6863\u6848\u53ef\u80fd\u9700\u8981\u65f6\u95f4\u3002<\/li>\n<\/ul>\n<p><strong>\u201c\u8fd9\u5c31\u50cf\u5236\u4f5c\u4e00\u4e2a\u6863\u6848\uff0carin\uff0c\u201d<\/strong>\u751f\u547d\u5468\u671f\u961f\u957f\u8bf4\uff0c<strong>\u201c\u968f\u7740\u65b0\u6545\u4e8b\u7684\u7f16\u5199\uff0c\u5fc5\u987b\u5bf9\u5176\u8fdb\u884c\u7ef4\u62a4\u548c\u66f4\u65b0\u3002\u201d<\/strong><\/p>\n<hr>\n<h3> <strong>3.\u589e\u91cf\u9759\u6001\u518d\u751f \u2013 \u81ea\u9002\u5e94\u5b88\u62a4\u8005<\/strong> <\/h3>\n<p><strong>\u201c\u4f46\u662f\u961f\u957f\uff0c\u201d<\/strong>arin \u76b1\u8d77\u7709\u5934\u601d\u8003\uff0c<strong>\u201c\u5982\u679c codex \u9700\u8981\u5237\u65b0\u5b83\u7684\u6545\u4e8b\u800c\u4e0d\u91cd\u5199\u6240\u6709\u5185\u5bb9\u600e\u4e48\u529e\uff1f\u201d<\/strong><\/p>\n<p>\u751f\u547d\u5468\u671f\u961f\u957f\u70b9\u70b9\u5934\u3002 <strong>\u201c\u8fd9\u5c31\u662f\u589e\u91cf\u9759\u6001\u518d\u751f\u7684\u7528\u6b66\u4e4b\u5730\u3002\u5b83\u662f\u4e00\u4e2a\u6839\u636e\u9700\u8981\u66f4\u65b0\u5185\u5bb9\u7684\u5b88\u62a4\u8005\uff0c\u4fdd\u6301\u9875\u9762\u65b0\u9c9c\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u5236\u4f5c\u6574\u4e2a\u5b58\u6863\u3002\u201d<\/strong><\/p>\n<p><strong>\u4f7f\u7528 node-cron \u7684\u8ba1\u5212 isr \u793a\u4f8b<\/strong>:<br \/> \u4e3a\u4e86\u4f7f\u9875\u9762\u4fdd\u6301\u6700\u65b0\uff0carin \u5f15\u5165\u4e86\u4e00\u4e2a\u4f1a\u6309\u8bbe\u5b9a\u65f6\u95f4\u95f4\u9694\u8fd0\u884c\u7684\u5b88\u62a4\u5492\u8bed\u3002<\/p>\n<pre>npm install node-cron\n<\/pre>\n<pre>const cron = require('node-cron');\n\ncron.schedule('0 * * * *', () =&gt; {\n  console.log('Regenerating static pages...');\n  require('.\/generateStaticBlogs');\n});\n\nconsole.log('Scheduled ISR running every hour.');\n<\/pre>\n<p><strong>\u963f\u6797\u7684\u89c1\u89e3<\/strong>\uff1a<br \/><strong>\u201c\u6709\u4e86 isr\uff0ccodex \u4e0d\u53ea\u662f\u505a\u51fa\u53cd\u5e94\uff0c\u5b83\u8fd8\u4f1a\u9002\u5e94\uff0c\u201d<\/strong>\u5979\u60f3\uff0c\u611f\u5230\u4e00\u79cd\u51c6\u5907\u5c31\u7eea\u7684\u611f\u89c9\u3002 <strong>\u201c\u7528\u6237\u5c06\u59cb\u7ec8\u53d1\u73b0 codex \u662f\u6700\u65b0\u7684\uff0c\u5e76\u51c6\u5907\u597d\u6307\u5bfc\u4ed6\u4eec\u3002\u201d<\/strong><\/p>\n<hr>\n<h3> <strong>\u7ed3\u8bba\uff1a\u8d85\u8d8a\u4f7f\u547d<\/strong> <\/h3>\n<p>\u907f\u96be\u6240\u9759\u9759\u5730\u77d7\u7acb\u7740\uff0c\u5e76\u56e0\u963f\u6797\u7f16\u7ec7\u7684\u77e5\u8bc6\u800c\u95ea\u95ea\u53d1\u5149\u3002\u751f\u547d\u5468\u671f\u961f\u957f\u5c06\u4e00\u53ea\u624b\u653e\u5728\u5979\u7684\u80a9\u8180\u4e0a\uff0c\u773c\u4e2d\u6d41\u9732\u51fa\u81ea\u8c6a\u3002 <strong>\u201c\u4f60\u5df2\u7ecf\u5b66\u4f1a\u4e86\u9884\u6e32\u67d3 codex \u7684\u672c\u8d28\u3002\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u6709\u8d85\u51fa\u6211\u4eec\u80fd\u529b\u8303\u56f4\u7684\u5de5\u5177\u53ef\u4ee5\u8ba9\u8fd9\u4e00\u5207\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\u201d<\/strong><\/p>\n<p>\u963f\u6797\u70b9\u70b9\u5934\uff0c\u660e\u767d\u524d\u9762\u7684\u8def\u3002 <strong>\u201c\u4e3a\u4e86\u6cd5\u5178\uff0c\u4e3a\u4e86\u7528\u6237\uff0c\u6211\u4eec\u51c6\u5907\u3001\u9002\u5e94\u5e76\u59cb\u7ec8\u670d\u52a1\u3002\u201d<\/strong><\/p>\n<hr>\n<h3> <strong>\u8bfb\u8005\u91cd\u8981\u6ce8\u610f\u4e8b\u9879<\/strong>\uff1a <\/h3>\n<p>\u6b64\u5904\u63d0\u4f9b\u7684\u793a\u4f8b\u662f\u7406\u89e3\u81ea\u5b9a\u4e49 ssr \u548c ssg \u7684\u57fa\u672c\u65b9\u6cd5\u3002\u5bf9\u4e8e\u751f\u4ea7\u7ea7\u5e94\u7528\u7a0b\u5e8f\uff0c\u8bf7\u7814\u7a76 <strong>next.js<\/strong>\u3001<strong>remix<\/strong> \u548c <strong>astro<\/strong> \u7b49\u6846\u67b6\uff0c\u5b83\u4eec\u4e3a\u9884\u6e32\u67d3\u63d0\u4f9b\u4f18\u5316\u3001\u5b89\u5168\u4e14\u53ef\u6269\u5c55\u7684\u89e3\u51b3\u65b9\u6848\u3002 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u8054\u60f3\u7535\u8111\u4e3b\u673a\u663e\u793a\u65e0\u6cd5\u542f\u52a8\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1 \u6536\u85cf \u73cd\u60dc\u65f6\u95f4\uff0c\u52e4\u594b\u5b66\u4e60\uff01\u4eca\u5929\u7ed9\u5927\u5bb6\u5e26\u6765\u300a\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1\u2014\u2014Arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 SSR \u548c SSG \u638c\u63e1\u300b\uff0c\u6b63\u6587\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\u7b49\u7b49\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6587\u7ae0\uff0c\u6216\u8005\u662f\u5bf9\u6587\u7ae0\u6709\u7591\u95ee\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u6211\uff01\u540e\u9762\u6211\u4f1a\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u5185\u5bb9\u7684\uff0c\u5e0c\u671b\u90fd\u80fd\u5e2e\u5230\u6b63\u5728\u5b66\u4e60\u7684\u5927\u5bb6\uff01 \u7b2c 10 \u96c6\uff1a\u4f1f\u5927\u7684\u9884\u6e32\u67d3\u4efb\u52a1 \u2013 arin \u5bfb\u6c42\u81ea\u5b9a\u4e49 ssr \u548c ssg \u7cbe\u901a \u6cd5\u5178\u9759\u6001\u5e93\u95ea\u70c1\u7740\u5b89\u9759\u7684\u671f\u5f85\u3002\u8fd9\u4e9b\u91d1\u5e93\u662f\u77e5\u8bc6\u7684\u6c89\u9ed8\u5b88\u62a4\u8005\uff0c\u5b83\u4eec\u7684\u5899\u58c1\u4e0a\u6392\u5217\u7740\u6570\u636e\u5377\u8f74\u548c\u53d1\u5149\u7684\u9875\u9762\uff0c\u7b49\u5f85\u7740\u7528\u6237\u7684\u53ec\u5524\u3002\u4eca\u5929\uff0carin \u7ad9\u5728\u8fd9\u4e9b\u91d1\u5e93\u7684\u95e8\u53e3\uff0c\u80a9\u8d1f\u7740\u638c\u63e1\u4e00\u9879\u65b0\u7684\u91cd\u8981\u5de5\u827a\u7684\u4efb\u52a1\uff1a\u521b\u5efa\u9759\u6001\u9884\u6e32\u67d3\u9875\u9762\uff0c\u5e2e\u52a9 codex \u6bd4\u4ee5\u5f80\u66f4\u5feb\u5730\u4e3a\u7528\u6237\u670d\u52a1\u3002 \u201c\u963f\u6797\u201d\u751f\u547d\u5468\u671f\u961f\u957f\u7684\u58f0\u97f3\u5728\u62f1\u5f62\u623f\u95f4\u91cc\u56de\u54cd\uff0c\u5438\u5f15\u4e86\u5979\u7684\u6ce8\u610f\u529b\u3002 \u201c\u4eca\u5929\uff0c\u60a8\u5c06\u5b66\u4e60\u5982\u4f55\u5229\u7528\u9759\u6001\u6e32\u67d3\u7684\u529b\u91cf\u3002\u8fd9\u4e0d\u4ec5\u4ec5\u662f\u77e5\u8bc6\u7684\u95ee\u9898\uff0c\u800c\u662f\u5728\u7528\u6237\u7684\u9700\u6c42\u51fa\u73b0\u4e4b\u524d\u5c31\u51c6\u5907\u597d codex \u6765\u6ee1\u8db3\u7528\u6237\u7684\u9700\u6c42\u3002\u201d \u8fd9\u5bf9\u771f\u6b63\u7684\u9632\u5b88\u8005\u6765\u8bf4\u662f\u4e00\u4e2a\u503c\u5f97\u6311\u6218\u7684\u6311\u6218\uff0c\u963f\u6797\u5fc3\u60f3\uff0c\u5979\u7684\u773c\u775b\u91cc\u95ea\u70c1\u7740\u575a\u5b9a\u7684\u5149\u8292\u3002\u662f\u65f6\u5019\u6253\u9020\u4e00\u4e2a\u7cfb\u7edf\uff0c\u5141\u8bb8 codex \u9884\u6e32\u67d3\u5176\u9875\u9762\uff0c\u786e\u4fdd\u5728\u8c03\u7528\u65f6\u7acb\u5373\u54cd\u5e94\u3002 1.\u5236\u4f5c\u6863\u6848 \u2013 \u4f7f\u7528 mdx \u6784\u5efa\u81ea\u5b9a\u4e49 ssg \u751f\u547d\u5468\u671f\u961f\u957f\u4e0e\u963f\u6797\u5e76\u80a9\u8d70\u5165\u907f\u96be\u6240\u7684\u6df1\u5904\u3002\u7528\u6570\u636e\u7167\u4eae\u7684\u5377\u8f74\uff0c\u63ed\u793a\u4e86\u65e9\u5728\u7528\u6237\u9700\u8981\u5b83\u4eec\u4e4b\u524d\u5c31\u5df2\u6e32\u67d3\u7684\u811a\u672c\u548c\u9875\u9762\u3002 \u201c\u4e3a\u4e86\u51c6\u5907\u6cd5\u5178\uff0c\u6211\u4eec\u5fc5\u987b\u5b66\u4f1a\u6355\u6349\u77e5\u8bc6\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u8fd9\u4e9b\u9875\u9762\u4e2d\uff0c\u201d\u4ed6\u8bf4\u3002 arin \u7684\u4efb\u52a1\u5f88\u660e\u786e\uff1a\u4e3a codex \u7684\u535a\u5ba2\u6784\u5efa\u9759\u6001\u7ad9\u70b9\u751f\u6210 (ssg) \u7cfb\u7edf\uff0c\u53ef\u4ee5\u968f\u65f6\u8c03\u7528\u8fc7\u53bb\u7684\u6545\u4e8b\u548c\u6559\u8bad\u3002 \u7b2c 1 \u6b65\uff1a\u6536\u96c6\u5de5\u5177 \u7b2c\u4e00\u6b65\u662f\u4e3a codex \u914d\u5907\u8bfb\u53d6\u548c\u7f16\u8bd1\u5176\u5377\u8f74\u7684\u65b9\u6cd5 &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52644","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52644"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52644\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}