This is an automated email from the ASF dual-hosted git repository. fenbox pushed a commit to branch community-blog in repository https://gitbox.apache.org/repos/asf/incubator-answer-website.git
commit 5a647dda474430b8a851d2b25c39b32a36306bb4 Author: fen <[email protected]> AuthorDate: Thu Nov 30 10:58:45 2023 +0800 docs: add contribute blog --- community/contributing/blog-post.md | 131 ++++++++++++++++++++++ community/contributing/development.md | 16 +-- community/contributing/plugins.md | 2 +- docs/{getting-started => development}/database.md | 0 docs/{development => guides}/plugins.md | 2 +- sidebars.js | 13 ++- sidebarsCommunity.js | 1 + 7 files changed, 152 insertions(+), 13 deletions(-) diff --git a/community/contributing/blog-post.md b/community/contributing/blog-post.md new file mode 100644 index 00000000..9faf6ca6 --- /dev/null +++ b/community/contributing/blog-post.md @@ -0,0 +1,131 @@ +--- +sidebar_label: Blog Post +slug: /blog-post +--- + +# Contribute a Blog Post + +Blogs are one of the easiest ways to [get involved](/community/contributing#get-involved) in Apache Answer. It is also a great way to share your knowledge and experience with others. + +If you've used Answer to build your own Q&A community, or if Answer has helped you solve a problem, we'd love to hear your story. We also encourage you to share tips and tricks for using Answer, or to write about how to contribute to the project. + +To get started, just read our blog guidelines and get writing! + +## Repository address + +- [GitHub](https://github.com/apache/incubator-answer-websit): Write and store blog posts. +- [Crowdin](https://crowdin.com/project/answer-website): Translate blog posts into multiple languages to make them more accessible to a wider audience. + +## Blog directory + +Blogs are currently available in two languages: English (default) and Chinese. If you're submitting a Chinese blog, you need to manually copy it to the /blog directory to prevent compilation errors. If you're only submitting English blogs, you don't need to do anything else. + +- English blogs: `/blog` +- Chinese blogs: `/i18n/docusaurus-plugin-content-blog` + +We've integrated with Crowdin, which automatically syncs files that need to be translated. This makes it easier for community contributors to get involved in the translation. + +## Blog categories + +Our current blog categories are: + +- Best Practices +- Tutorials +- Insights +- Releases +- Tech + +Besides submitting a new blog, you can also help maintain existing blog content by identifying and correcting any incorrect or unclear language, or updating the content to reflect the latest information. + +## Submit a blog + +### Environment setup + +The project preview and run depend on [node](https://nodejs.org) and [pnpm](https://pnpm.io). Please install them in advance. + +### Add author information + +All author information is stored in the following files: + +- `/blog/authors.yml` +- `/i18n/docusaurus-plugin-content-blog/authors.yml` + +You can add information to display about yourself in these files. Here’s an example. + +```yaml title="/blog/authors.yml" +Anne: + name: Anne Zhu + title: Product Marketing Manager + url: https://github.com/PrimmaAnna + image_url: https://avatars.githubusercontent.com/u/131739771?v=4 + +# Use in the blog's frontMeta +--- +authors: [Anne] # separate with commas [Anne, others] +--- +``` + +### Process + +1. Make sure to put the new blog documents in the correct path. + + - **For English blog**: Create a new Markdown file in the `/blog` directory. + - **For Chinese blog**: Create a new Markdown file in the `/i18n/zh-CN/docusaurus-plugin-content-blog/` directory. + +2. To ensure that the final article URL follows a format like `/blog/2023/06/01/hello-world`, we've established the following naming convention for each article file: + + - **Plain Text** + - Directly create a file named `2023-06-01-hello-world.md` in the `/blog` directory. + - **Rich Text** + - Create a directory named `/2023-06-01-foo-bar` in the `/blog` directory. + - Create an `index.md` file inside the `/2023-06-01-foo-bar` directory. + - Images and other multimedia content should also be placed within this directory. + + To maintain semantic and unique article URLs, we recommend using the blog's title after the date when naming files or folders. Convert the title to lowercase and connect the words with hyphens. This eliminates the need to worry about the slug field on the page. Avoid specifying the slug field unless it's absolutely necessary. + + For instance, if the blog's title is `Hello World`, the file can be named `2023-06-01-hello-world` This will generate the URL `/blog/2023-06-01/hello-world`. + + ```shell + blog + ├── 2023-06-01-foo-bar # Use directory for images. + │ ├── index.md + │ ├── sample.png + │ └── ... + ├── 2023-06-01-hello-world.md # Use file for plain text. + └── ... + ``` + + To ensure file compatibility across platforms, please avoid using special characters `/ ? * : | \ < > & #` in file names. + +3. Learn Markdown syntax in [Docusaurus Markdown](https://docusaurus.io/docs/markdown-features). If images are included, make sure the images and the blog are in the same directory . + + Apart from the standard metadata fields, we've also introduced some custom fields and their usage, such as "cover image" (image) and "featured post" (Featured). + + The cover image needs to adhere to our visual style guidelines, so you can focus on writing your blog post. Once submitted, we'll automatically generate a cover image based on your content. + + The "featured" field determines whether your blog post appears on the [Blog](/blog) homepage. To have your blog post featured, set the "featured" field to "true". + + Check the example below. + + ```yaml + title: The What, Why Using Tags for Online Community + authors: [Anne] + category: Insights // value reference in blog type + featured: true + image: [email protected] // Note: place it in the /static/img/blog directory. + description: "Discover more about tags, benefits, and how vital they are for organizing content in online community." + ``` + +4. Before submitting your code, please ensure that it runs error-free. You can check it by running the following commands. + + ```shell + # Preview locally + pnpm start # to preview the Chinese docs, run pnpm start:zh) + + # Locally compile to ensure no errors before submitting + pnpm build # no errors when display [SUCCESS] Generated static files in "build/zh-CN" + ``` + +## Others + +For code submitting, you may also need to learn [Git](https://git-scm.com/) and [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork). diff --git a/community/contributing/development.md b/community/contributing/development.md index fc5c6a14..d5acbc28 100644 --- a/community/contributing/development.md +++ b/community/contributing/development.md @@ -12,8 +12,8 @@ slug: /development 2. After cloning the repository, run the following command. This will install all dependencies as well as build all local packages. ```shell - $ cd ./ui - $ pnpm install + cd ./ui + pnpm install ``` 3. To start a development server, run `pnpm start`. now, your browser should already open automatically, and autoload `http://localhost:3000`. you can also manually visit it. @@ -25,7 +25,6 @@ slug: /development - We do have Prettier (a formatter) and ESLint (a syntax linter) to catch most stylistic problems. If you are working locally, you can run `pnpm lint` and `pnpm prettier` to fix most code formatting. - **No runtime errors** Before submitting the code, please ensure that there will be no errors when running locally. This will greatly reduce the workload of review. - ## Backend ### Installation @@ -34,17 +33,18 @@ slug: /development 2. After cloning the repository, run the following command for build. ```shell - $ go mod download - $ go run cmd/answer/main.go init -C ./answer-data + go mod download + go run cmd/answer/main.go init -C ./answer-data ``` -3. Visit `http://localhost/` to see the installation page and complete the installation. +3. Visit `http://localhost` to see the installation page and complete the installation. 4. Run the following command to start the server. + ```shell - $ go run cmd/answer/main.go run -C ./answer-data + go run cmd/answer/main.go run -C ./answer-data ``` ### Code conventions -We recommend that you follow [uber's Golang Guidelines](https://github.com/uber-go/guide) code style. \ No newline at end of file +We recommend that you follow [uber's Golang Guidelines](https://github.com/uber-go/guide) code style. diff --git a/community/contributing/plugins.md b/community/contributing/plugins.md index 0d1c381b..8f9c6087 100644 --- a/community/contributing/plugins.md +++ b/community/contributing/plugins.md @@ -1,5 +1,5 @@ --- -sidebar_label: Plugins +# sidebar_label: Plugins slug: /plugins --- diff --git a/docs/getting-started/database.md b/docs/development/database.md similarity index 100% rename from docs/getting-started/database.md rename to docs/development/database.md diff --git a/docs/development/plugins.md b/docs/guides/plugins.md similarity index 99% rename from docs/development/plugins.md rename to docs/guides/plugins.md index 57298ef8..2216bc44 100644 --- a/docs/development/plugins.md +++ b/docs/guides/plugins.md @@ -2,7 +2,7 @@ slug: /plugins --- -# Plugins +# Using Plugins :::tip diff --git a/sidebars.js b/sidebars.js index 30c991c9..9fdf2ed3 100644 --- a/sidebars.js +++ b/sidebars.js @@ -28,15 +28,15 @@ module.exports = { 'getting-started/upgrade', 'getting-started/command-line', 'getting-started/configfile', - 'getting-started/database', 'getting-started/env', ], }, { type: 'category', - label: 'Guides', + label: 'User Guides', collapsed: true, items: [ + 'guides/plugins', 'guides/permission', 'guides/reputation', 'guides/flags', @@ -44,7 +44,14 @@ module.exports = { 'guides/settings', ], }, - 'development/plugins', + { + type: 'category', + label: 'Developer Guides', + collapsed: true, + items: [ + 'development/database', + ], + }, 'notice', 'faq', ], diff --git a/sidebarsCommunity.js b/sidebarsCommunity.js index f278a4d8..1cdac308 100644 --- a/sidebarsCommunity.js +++ b/sidebarsCommunity.js @@ -28,6 +28,7 @@ module.exports = { ], }, 'contributing/translation', + 'contributing/blog-post', 'contributing/how-to-release', ], },
