Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add docusaurus website #13039

Merged
merged 19 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: i18n
  • Loading branch information
DIYgod committed Aug 14, 2023
commit cfdb3613ed0604381c7bb3aacf0b639b2690b63b
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/README.md → website/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
sidebarDepth: 0
displayed_sidebar: guideSidebar
---

# 介绍

<p align="center" class="logo-img">
<img src="/img/logo.png" alt="RSSHub" width="100" />
<img src="img/logo.png" alt="RSSHub" width="100" />
</p>
<h1 align="center" class="logo-text">RSSHub</h1>

Expand Down
6 changes: 2 additions & 4 deletions docs/en/README.md → website/docs/_en/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
---
sidebarDepth: 0
---


# Introduction

<p align="center" class="logo-img">
<img src="/img/logo.png" alt="RSSHub" width="100" />
<img src="img/logo.png" alt="RSSHub" width="100" />
</p>
<h1 align="center" class="logo-text">RSSHub</h1>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions website/docs/_en/joinus/advanced/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Advanced",
"position": 4,
"collapsed": false
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 1
---

# RSS Feed Fundamentals

This guide is intended for advanced users who want to know how to create an RSS feed in detail. If you're new to creating RSS feeds, we recommend reading [Create Your Own RSSHub Route](/en/joinus/new-rss/start-code.html) first.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 0
sidebar_position: 5
---

# Debugging

When debugging your code, you can use more than just `console.log` or attaching the node process to a debugger. You can also use the following methods for debugging.
Expand Down Expand Up @@ -31,4 +32,4 @@ In the example above, we're passing the `info` object to `ctx.state.json`, which

In order to quickly test if the `description` in `ctx.state.data` is correct, you can use the `.debug.html` file suffix to obtain the HTML of the corresponding entry. The link can be directly opened in the browser to preview the rendering result.

Usage: Access the corresponding route + `.{index}.debug.html`, where `{index}` is the item number (starting from 0) in your `ctx.state.data.item`. And the data corresponds to the `ctx.state.data.item[index].description` information will be returned as route result.
Usage: Access the corresponding route + `.{index}.debug.html`, where `{index}` is the item number (starting from 0) in your `ctx.state.data.item`. And the data corresponds to the `ctx.state.data.item[index].description` information will be returned as route result.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 4
---

# Date Handling

When you visit a website, the website usually provides you with a date or timestamp. This tutorial will show you how to properly handle them in your code.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 2
---

# Script Standard

## Code Style
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 3
---

# Using Cache

All routes have a cache that expires after a short duration. You can change how long the cache lasts by modifying the `CACHE_EXPIRE` value in the `lib/config.js` file using environment variables. However, for interfaces that have less frequently updated content, it's better to specify a longer cache expiration time using `CACHE_CONTENT_EXPIRE` instead.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 3
---

# New RSSHub Radar Rules

If you want to see the results, we suggest you install the browser extension. You can download it for your browser on the [Join Us](/en/joinus/quick-start.html#submit-new-rsshub-radar-rules-before-you-start) page.
Expand Down
5 changes: 5 additions & 0 deletions website/docs/_en/joinus/new-rss/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "New RSSHub Rules",
"position": 2,
"collapsed": false
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import RouteEn from '@site/src/components/RouteEn';

---
sidebarDepth: 2
sidebar_position: 4
---

import RouteEn from '@site/src/components/RouteEn';

# Add documentation

Now that we have completed the code, it's time to add the documentation for your route. Open the appropriate file in the [documentation (/docs/en/)](https://github.com/DIYgod/RSSHub/blob/master/docs/en), which in this example is `docs/en/programming.md`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 2
---

# Just before you start

In this tutorial, we will walk you through the process of creating an RSS feed for [GitHub Repo Issues](/en/programming.html#github-repo-issues) as an example.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 1
---

# Prerequisites

Before you begin, it is important that your development environment set up properly.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 3
---

# Create Your Own RSSHub Route

As mentioned earlier, we will create an RSS feed for [GitHub Repo Issues](/en/programming.html#github-repo-issues) as an example. We will show all four data collection methods mentioned:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 5
---

# Submit your route

Once you have finished your route, you can submit a pull request (hereafter referred to as PR) to [RSSHub](https://github.com/DIYgod/RSSHub). We use a squash merge strategy, meaning all commits in your branch will be merged into one commit on RSSHub's repository. However, keeping your commit history clean and tidy is still important. We've also provided an intuitive template for you to fill out.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Join Us
---
sidebar_position: 1
---

# Quick Start

If you've found a bug or have a suggestion for improving RSSHub, we'd love to hear from you! You can submit your changes by creating a pull request. Don't worry if you're new to pull requests - we welcome contributions from developers of all experience levels. Don't know how to code? You can also help by [reporting bugs](https://github.com/DIYgod/RSSHub/issues).

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions website/docs/joinus/advanced/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "高级用法",
"position": 4,
"collapsed": false
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 1
---

# RSS 基础

本指南面向希望深入了解如何制作 RSS 订阅源的高级用户。如果您是第一次制作 RSS 订阅源,我们建议先阅读 [制作自己的 RSSHub 路由](/joinus/new-rss/start-code.html)。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 0
sidebar_position: 5
---

# 调试

当调试代码时,除了使用 `console.log` 或将 node 进程附加到调试器,您还可以使用如下方式进行调试。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 4
---

# 日期处理

当你访问网站时,网站通常会提供一个日期或时间戳。本指南将展示如何在代码中正确处理它们。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebarDepth: 2
sidebar_position: 2
---

# 路由规范
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 3
---

# 使用缓存

所有路由都有一个缓存,该缓存在短时间后过期。您可以通过环境变量来修改 `lib/config.js` 文件中的 `CACHE_EXPIRE` 值使用来更改缓存的持续时间。然而,对于那些内容更新较少的接口,最好是使用 `CACHE_CONTENT_EXPIRE` 来指定较长的缓存过期时间。
Expand Down
4 changes: 4 additions & 0 deletions docs/joinus/new-radar.md → website/docs/joinus/new-radar.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 3
---

# 提交新的 RSSHub Radar 规则

如果需要查看新规则的结果,建议您安装浏览器扩展程序。您可以在 [参与我们](/joinus/quick-start.html#ti-jiao-xin-de-rsshub-radar-gui-ze) 页面下载适合您浏览器的扩展程序。
Expand Down
5 changes: 5 additions & 0 deletions website/docs/joinus/new-rss/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "提交新的 RSSHub 规则",
"position": 2,
"collapsed": false
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Route from '@site/src/components/Route';

---
sidebarDepth: 2
sidebar_position: 4
---

import Route from '@site/src/components/Route';

# 添加文档

现在我们完成了代码,是时候为您的路由添加文档了。在 [文档 (/docs/)](https://github.com/DIYgod/RSSHub/blob/master/docs) 中打开相应的文件,本例中是 `docs/programming.md`。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 2
---

# 开始之前

在本教程中,我们将通过制作一个 [GitHub 仓库 Issues](/programming.html#github-cang-ku-issues) 的 RSS 源为例,向您展示制作 RSS 源的过程。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
sidebar_position: 1
---

# 准备工作

在开始编写新的 RSS 规则之前,确保您的开发环境已正确配置很重要。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 3
---

# 制作自己的 RSSHub 路由

如前所述,我们以 [GitHub 仓库 Issues](/programming.html#github-cang-ku-issues) 为例制作 RSS 源。我们将展示前面提到的四种数据获取方法:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebarDepth: 2
sidebar_position: 5
---

# 提交路由

当您完成您的路由后,您可以提交一个 Pull Request(下称 PR)到 [RSSHub](https://github.com/DIYgod/RSSHub)。我们将使用 squash merge 策略,这意味着您分支中的所有提交将合并成 RSSHub 仓库上的一个提交。然而,保持您的提交历史干净整洁仍然很重要。我们还提供了一个直观的模板供您填写。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# 参与我们
---
sidebar_position: 1
---


# 快速开始

如果您在使用 RSSHub 过程中遇到了问题或者有建议改进,我们很乐意听取您的意见!您可以通过 Pull Request 来提交您的修改。无论您对 Pull Request 的使用是否熟悉,我们都欢迎不同经验水平的开发者参与贡献。如果您不懂编程,也可以通过 [报告错误](https://github.com/DIYgod/RSSHub/issues) 的方式来帮助我们。

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 39 additions & 7 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const config = {
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh'],
defaultLocale: 'zh',
locales: ['zh', 'en'],
},

presets: [
Expand All @@ -38,7 +38,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: '../docs',
// path: '../docs',
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
Expand All @@ -57,7 +57,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
image: 'img/logo.png',
navbar: {
title: 'RSSHub',
logo: {
Expand All @@ -66,10 +66,42 @@ const config = {
},
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
to: '/',
position: 'left',
label: 'Tutorial',
label: '指南',
},
{
type: 'dropdown',
label: '参与我们',
position: 'left',
items: [
{
to: '/joinus/quick-start',
label: '快速开始',
},
{
to: '/joinus/advanced/script-standard',
label: '路由规范',
},
{
to: '/joinus/advanced/pub-date',
label: '日期处理',
},
{
to: '/joinus/advanced/use-cache',
label: '使用缓存',
},
],
},
{
to: '/install',
position: 'left',
label: '部署',
},
{
to: '/support',
position: 'left',
label: '支持 RSSHub',
},
{
type: 'localeDropdown',
Expand Down
Loading