我正在使用 Docusaurus 构建一个具有自定义域名并由 GitHub 页面托管的网站,一切正常。但运行后docusaurus-buildCNAME 文件被删除。导致我的网站无法从我的自定义域访问。
我尝试重新添加 CNAME 文件并不能帮助它在每次构建后被删除。
我知道 docusaurus 会替换构建目录中的所有文件,但如何防止它删除我的 CNAME 文件?
我的 siteConfig 文件如下所示:
const siteConfig = {
title: 'Harry Stylesheet' /* title for your website */,
tagline: 'My Website',
url: 'http://harrystylesheet.com' /* your website url */,
baseUrl: '/' /* base url for your project */,
// Used for publishing and more
projectName: 'harrystylesheet.github.io',
organizationName: 'Harry Stylesheet',
....
....
....
}
Run Code Online (Sandbox Code Playgroud)
现在我的解决方案是在我的存储库中重新配置我的 GitHub 页面设置,这样其他人就会遇到同样的问题吗?
我有一个带有 React 组件的页面,该组件使用多个详细/摘要标签:
const React = require("react");
class samplePage extends React.Component {
render() {
const siteConfig = this.props.config;
return (
<div>
<details>
<summary>
First text detail.
</summary>
</details>
<details>
<summary>
Second text detail.
</summary>
</details>
<details>
<summary>
Third text detail.
</summary>
</details>
<button onClick="OpenAll()">Open All Details.</button>
<button onClick="CloseAll()">Close All Details.</button>
</div>
);
}
}
module.exports = samplePage;
Run Code Online (Sandbox Code Playgroud)
我有一个全局siteConfig.js来配置我的脚本:
scripts: [
"js/script1.js",
"js/script2.js",
"js/script3.js"
],
Run Code Online (Sandbox Code Playgroud)
使用 2 个函数在上述详细信息标签中添加或删除“open”属性:
function CloseAll() {
$("details").removeAttr("open");
}
function OpenAll() {
$("details").attr("open", "open");
} …Run Code Online (Sandbox Code Playgroud) 有没有一种简单的方法可以在 Docusaurus V2 markdown 中创建可折叠部分?
会在 GitHub 上寻找类似的东西:https : //gist.github.com/joyrexus/16041f2426450e73f5df9391f7f7ae5f
我创建了一个 docusaurus 项目。一切正常。我在登陆页面添加了材质 ui 搜索栏。我正在使用 github actions 来部署项目(CI/CD)。现在,当我推送代码时,我收到此错误。
[ERROR] TypeError: dep.getModuleEvaluationSideEffectsState is not a function
at NormalModule.getSideEffectsConnectionState (/github/workspace/website/node_modules/webpack/lib/NormalModule.js:1126:23)
at /github/workspace/website/node_modules/webpack/lib/optimize/SideEffectsFlagPlugin.js:244:19
at Hook.eval [as call] (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:12:16)
at Hook.CALL_DELEGATE [as _call] (/github/workspace/website/node_modules/tapable/lib/Hook.js:14:14)
at Compilation.seal (/github/workspace/website/node_modules/webpack/lib/Compilation.js:2804:42)
at /github/workspace/website/node_modules/webpack/lib/Compiler.js:1187:20
at /github/workspace/website/node_modules/webpack/lib/Compilation.js:2757:4
at _next2 (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:35:1)
at eval (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:71:1)
at /github/workspace/website/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:385:11
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决这个问题。我还附加了 package.json 文件。
[ERROR] TypeError: dep.getModuleEvaluationSideEffectsState is not a function
at NormalModule.getSideEffectsConnectionState (/github/workspace/website/node_modules/webpack/lib/NormalModule.js:1126:23)
at /github/workspace/website/node_modules/webpack/lib/optimize/SideEffectsFlagPlugin.js:244:19
at Hook.eval [as call] (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:19:10), …Run Code Online (Sandbox Code Playgroud)我正在尝试通过 IIS10 上的 PM2 在 Windows Server 2016 上使用 Node.js 版本 12.14.0运行Docusaurus 。我正在使用 PM2,因此我可以在服务器重新启动后重新启动应用程序。我现在必须承认,今天是我第一次尝试使用 Node.js,所以请耐心等待。
这通常通过在 Docusaurus 目录中调用来运行。npm run start在测试 Node.js 以及“Hello World”应用程序是否会在服务器重新启动时启动时,我使用了ecosystem.config.jsPM2 文档中建议的方法。这称为一个 javascript 文件,如下所示。
module.exports = {
apps: [
{
name: "HelloWorld",
script: "apps\\hello_world.js",
instances: 1
}
]
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我找不到任何有关如何npm start从该文件运行的文档(尽管我确实尝试调用单独的批处理文件,但这也不起作用)。然后我在这里看到我可以调用一个记录了更多选项的 JSON 文件。
JSON 配置文件:
{
"apps": [
{
"name": "docs",
"cwd": "apps\\docs",
"script": "npm",
"args": "start"
},
{
"name": "HelloWorld",
"script": "apps\\hello_world.js"
}
]
}
Run Code Online (Sandbox Code Playgroud)
“HelloWorld”脚本启动,但文档应用程序不启动。 …
在我的 docusaurus.config.js 文件中,我有以下内容定义了导航栏的内容:
navbar: {
title: 'Utili Documentation',
logo: {
alt: 'Utili Logo',
src: 'https://file.utili.xyz/UtiliSmall.png',
},
items: [
{
href: 'https://utili.xyz/',
label: 'Utili',
position: 'right',
},
{
href: 'https://github.com/230Daniel/UtiliDocs/',
label: 'GitHub',
position: 'right',
},
],
},
Run Code Online (Sandbox Code Playgroud)
我想将导航栏标题的链接从https://docs.utili.xyz/更改为https://docs.utili.xyz/docs。我怎么能这样做呢?我尝试添加 href 值,但是在构建时我被告知它无效。
我正在使用 Docusaurus 2。
我想放一个图标,请能做到这一点的人解释一下我可以在哪个文件中做到这一点以及如何做到这一点?
themeConfig: {
navbar: {
title: 'graphql-go/graphql',
logo: {
alt: 'My Site Logo',
src: 'img/GraphQL_Logo.png',
},
items: [
{
href: '/docs/tutorial-basics/overview',
label: 'Docs',
position: 'left',
},
// {to: '/blog', label: 'Blog', position: 'left'},
{
href: 'https://github.com/graphql-go/graphql',
label: 'GitHub',
position: 'right',
},
],
},
Run Code Online (Sandbox Code Playgroud) docusaurus ×7
javascript ×3
reactjs ×3
cname ×1
github-pages ×1
html ×1
node.js ×1
npm ×1
pm2 ×1