-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ai4agi/dev
feat: add nextra framework
- Loading branch information
Showing
29 changed files
with
3,237 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
## Awesome-AIGC-Info | ||
|
||
|
||
|
||
|
||
# Start as New Project | ||
## Install | ||
```shell | ||
yarn add next react react-dom nextra nextra-theme-docs | ||
``` | ||
|
||
> If you already have Next.js installed in your project, you only need to install nextra and nextra-theme-docs as the add-ons. | ||
Add the following scripts in package.json: | ||
```json | ||
package.json | ||
"scripts": { | ||
"dev": "next", | ||
"build": "next build", | ||
"start": "next start" | ||
}, | ||
``` | ||
|
||
You can either start the server with, for example if you use npm, npm run dev, which will run in development mode or npm run build && npm run start for production mode. | ||
|
||
|
||
## Add Next.js Config | ||
|
||
Create the following `next.config.ts` file in your project’s root directory: | ||
|
||
```ts | ||
const withNextra = require('nextra')({ | ||
theme: 'nextra-theme-docs', | ||
themeConfig: './theme.config.jsx' | ||
}) | ||
|
||
module.exports = withNextra() | ||
|
||
// If you have other Next.js configurations, you can pass them as the parameter: | ||
// module.exports = withNextra({ /* other next.js config */ }) | ||
``` | ||
|
||
With the above configuration, Nextra can handle Markdown files in your Next.js project, with the specified theme. Other Nextra configurations can be found in [Guide](https://nextra.site/docs/guide). | ||
|
||
|
||
## Create Docs Theme Config | ||
Lastly, create the corresponding `theme.config.jsx` file in your project’s root directory. This will be used to configure the Nextra Docs theme: | ||
|
||
```jsx | ||
export default { | ||
logo: <span>My Nextra Documentation</span>, | ||
project: { | ||
link: 'https://github.com/shuding/nextra' | ||
} | ||
// ... other theme options | ||
} | ||
``` | ||
Full theme configurations can be found here. | ||
|
||
## Ready to Go! | ||
Now, you can create your first MDX page as `pages/index.mdx`: | ||
|
||
```mdx | ||
# Welcome to Nextra | ||
|
||
Hello, world! | ||
``` | ||
And run the next or next dev command specified in package.jsonto start developing the project! 🎉 | ||
|
||
# Add I18n Config | ||
## Add Config | ||
To add multi-language pages to your Nextra application, you need to config i18n in `next.config.js` first: | ||
|
||
```js | ||
next.config.js | ||
const withNextra = require('nextra')({ | ||
theme: 'nextra-theme-docs', | ||
themeConfig: './theme.config.tsx' | ||
}) | ||
|
||
module.exports = withNextra({ | ||
i18n: { | ||
locales: ['en-US', 'zh-CN', 'de-DE'], | ||
defaultLocale: 'en-US' | ||
} | ||
}) | ||
``` | ||
|
||
## Add Middleware | ||
Then, you need to add a `middleware.js` file in the root of your project (related Next.js docs): | ||
```js | ||
export { locales as middleware } from 'nextra/locales' | ||
``` | ||
If you already have the middleware defined, you can do this instead: | ||
|
||
```js | ||
import { withLocales } from 'nextra/locales' | ||
|
||
export const middleware = withLocales(request => { | ||
// Your middleware code... | ||
}) | ||
``` | ||
Add Locale to Filenames | ||
Then, add the locale codes to your file extensions (required for the default locale too): | ||
|
||
/pages | ||
_meta.en-US.json | ||
_meta.zh-CN.json | ||
_meta.de-DE.json | ||
index.en-US.md | ||
index.zh-CN.md | ||
index.de-DE.md | ||
... | ||
|
||
Configure the Docs Theme | ||
Finally, add the i18n option to your theme.config.jsx to configure the language dropdown: | ||
|
||
theme.config.jsx | ||
i18n: [ | ||
{ locale: 'en-US', text: 'English' }, | ||
{ locale: 'zh-CN', text: '中文' }, | ||
{ locale: 'de-DE', text: 'Deutsch' }, | ||
{ locale: 'ar-SA', text: 'العربية', direction: 'rtl' } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
## Awesome-AIGC-Info | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
## 前言 | ||
|
||
[](https://github.com/ai4agi/Awesome-AIGC-Info) | ||
[](https://opensource.org/licenses/MIT) | ||
 | ||
[](https://github.com/ai4agi/Awesome-AIGC-Info) | ||
|
||
|
||
English | [中文版](README_ZH.md) | ||
|
||
使用协议 | ||
本仓库遵循 FastGPT Open Source License 开源协议。 | ||
|
||
允许作为后台服务直接商用,但不允许提供 SaaS 服务。 | ||
未经商业授权,任何形式的商用服务均需保留相关版权信息。 | ||
完整请查看 FastGPT Open Source License | ||
联系方式:[email protected],点击查看商业版定价策略 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { withLocales } from 'nextra/locales' | ||
|
||
export const middleware = withLocales(request => { | ||
// Your middleware code... | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const withNextra = require('nextra')({ | ||
theme: 'nextra-theme-docs', | ||
themeConfig: './theme.config.jsx', | ||
latex: true | ||
}) | ||
|
||
module.exports = withNextra({ | ||
i18n: { | ||
locales: ['zh-CN', 'en-US'], | ||
defaultLocale: 'zh-CN' | ||
}, | ||
// domains: [{ | ||
// domain: 'info.ai4agi.org', | ||
// defaultLocale: 'zh-CN' | ||
// }, | ||
// { | ||
// domain: 'info.ai4agi.cn', | ||
// defaultLocale: 'zh-CN' | ||
// } | ||
// ] | ||
} | ||
) | ||
// If you have other Next.js configurations, you can pass them as the parameter: | ||
// module.exports = withNextra({ /* other next.js config */ }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"scripts": { | ||
"dev": "next", | ||
"build": "next build", | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"next": "^14.1.0", | ||
"nextra": "^2.13.3", | ||
"nextra-theme-docs": "^2.13.3", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"index": "Homepage", | ||
"contact": "Contact Us", | ||
"about": "About Us" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"index": { | ||
"title": "首页", | ||
"theme": { | ||
"breadcrumb": false, | ||
"footer": true, | ||
"sidebar": false, | ||
"toc": true, | ||
"pagination": false | ||
} | ||
}, | ||
"official_account": { | ||
"title": "公众号", | ||
"type": "page" | ||
}, | ||
"----": { | ||
"type": "separator" | ||
}, | ||
"aigc-job": { | ||
"title": "AIGC 求职", | ||
"type": "page" | ||
}, | ||
"---": { | ||
"type": "separator" | ||
}, | ||
"about": "关于我们", | ||
"contact": "联系我们", | ||
"github_link": { | ||
"title": "Github", | ||
"href": "https://github.com/ai4agi/Awesome-AIGC-Info" | ||
} | ||
} |
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"index": "AIGC Job Homepage" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"index": "AIGC 求职", | ||
"aigc_knowledge": { | ||
"title": "AIGC 知识库", | ||
"type": "page" | ||
}, | ||
"interview_experience": "AIGC 面试经验" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"index": "AIGC 知识点" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# AIGC知识点 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Welcome to Awesome AIGC Info | ||
|
||
Hello, world! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# 关于AIGC求职 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"index": "AIGC 面经", | ||
"----": { | ||
"type": "separator" | ||
}, | ||
"resume_template": { | ||
"title": "简历模板" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# AIGC面经 |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Welcome to Awesome AIGC Info | ||
|
||
Hello, world! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 欢迎来到 Awesome AIGC Info | ||
|
||
Hello, world! | ||
|
||
|
||
|
||
The **Pythagorean equation**: $a=\sqrt{b^2 + c^2}$. |
Empty file.
Oops, something went wrong.