Blog Contributing Guide
#
OverviewThis guideline will teach you how to contribute if you want to add a new blog, or modify existing blog contents.
If you find an issue on current documents, please feel free to file an issue and let the community know about it, or you can sumbit a pull request to fix or update. Both actions are welcome and recommended.
The blogs are written in two languages: English and Chinese. We encourage contributors to add blogs in their preferred language. It is completely up to you. We can handle translations and ask you to do a pull request review later.
English blogs are located in the website/blog
directory, in which they are categorized by year, month and date. For example, website/blog/2021/11/22/develop-apisix-ingress-with-nocalhost-in-kubernetes.md
means that a blog named develop-apisix-ingress-with-nocalhost-in-kubernetes.md
was published on November 22nd, 2021, and it is located in the website/blog/2021/11/22
directory. Once it is reviewed and megered, the URL should be: https://apisix.apache.org/blog/2021/11/22/develop-apisix-ingress-with-nocalhost-in-kubernetes
.
Similarly, Chinese blogs are located in website/i18n/zh/docusaurus-plugin-content-blog
directory and follow the same patterns described above.
#
What you can contributeWe encourge contributors and users to write blogs about how they contribute or use Apache APISIX, or help us fix typos and update contents in existing blogs.
#
Add a new blogTo add a new blog, please perform the following steps:
Find the right place to store your blog.
- If you plan to submit a blog written in English, please create a markdown file under
website/blog
directory. - If you plan to submit a blog written in Chinese, please create a markdown file under
website/i18n/zh/docusaurus-plugin-content-blog
directory. - If you cannot find an existing year, month, or date directory that fits your desired published date, you can go ahead and create such directory on your own.
- If you plan to submit a blog written in English, please create a markdown file under
Create a markdown file in the directory. Please make sure that the file name is written in English with NO capitalized letters. During review session, we may suggest changing it to achieve better SEO performance (Yes, currently some files names contain capitalized letters, we are working on it, see Issue #713).
Add text, images, diagrams, charts to the markdown file.
- There is nothing much to say about adding text.
- To add images, please upload images to by using this public image CDN service , and copy the links from there.
- To add charts or diagrams, we are happy to see any sort of charts and diagrams. From previous experience, charts with 4 columns or less are the perfect size displayed on screen.
Optional: run it locally to inspect any typos or formatting issues left behind. Although we implemented lint and error checks in the repository, we suggest running it locally to avoid repeated work. To run it locally, please run
cd website
, and then runyarn start
commands in your terminal.Submit a pull request to our repository.
#
Blog's header information#
Single author templateOur blogs start with a header sections containing fields such as title
, author
, authorURL
, authorImageURL
, keywords
, description
, and tags
.
While title
and author
are starightforward, the other fields might be a bit confusing for first-time contributors. Explanation of each field is mentioned below. Please note that these fields could change over time.
title: "blog's title"author: "blog's author"authorURL: "author's GitHub ID"authorImageURL: "author's GitHub Image"keywords:- keywords 1- keywords 2- keywords 3- keywords 4- keywords 5description: description of this blogtags: [tag1]
#
Co-author templateCo-author feature is added, since translating and editing articles is also time-consuming, we would like to give credit to translators and technical writers as well.
title: "blog's title"authors: - name: "Author's Name" title: "Author's title" url: "Author's GitHub" image_url: "Author's Image URL" - name: "Translator/Technical Writer's name" url: "Translator/Technical Writer's GitHub" image_url: "Translator/Technical Writer's Image URL"keywords:- keywords 1- keywords 2- keywords 3- keywords 4- keywords 5description: description of this blogtags: [tag1]
#
titleRequired field for single author template, the title of the article, the standard expression in the form of title: "title"
.
#
authorRequired field for single author template, the article's author name, the standard form of expression for author: "author"
.
Community author: if you are willing to provide your real name, use your real name, if not, use your GitHub account name.
Business case authors: please provide real name, such as John Doe.
#
authorURLFor business users or business cases, you can leave this item blank. Because GitHub is personal, and in the case of a business case, the person represents his company rather than himself, it is recommended that you leave this blank to avoid unnecessary controversy. This does not mean leave authorURL
: blank, it means just delete the entire line that corresponds to it, including the variable name.
#
authorImageURLThe author's GitHub avatar, it is related with authorURL
. For the same reason described above, this is an optional field. See below for how to get the avatar.
#
authorsThe required field for co-author template. When a blog is co-authored by 2 people, please use authors
instead of author
to give credits to both authors. authors
consists of the following fields: authors.name
, authors.url
, authors.title
and authors.image_url
.
authors.name
: authors' names in plain text, for example:name: "John Doe"
.authors.title
: author's title in plain text, for example:title: "Technical Writer"
.authors.url
: authors' GitHub pages, for example:url: "https://github.com/yzeng25"
.authors.image_url
: author's GitHub avatar, for example:authors.image_url: "https://avatars.githubusercontent.com/u/36651058?v=4"
.
#
keywordsRequired field, keyword, which is used to enhance better SEO performance. Usually the first three keywords are "APISIX", "Apache APISIX", "API Gateway", and the last two are the article's own keywords.
#
descriptionRequired field, the description, which is used to enhance better SEO performance. Usually you can summarize the first or last paragraph of the article, forming about 120 words of text, and put it here.
#
tagsRequired field, tag, which is used to categorize the blog. Each post has and can only have one tag. If more than one tag is suitable, please choose the most suitable one. The available tags and explanations are as follows. Please note that these tags and rules of applying tags could change over time.
- Community: community related, e.g. "How to contribute to an open source project without writing code?"
- Events: event-related, for example: online live stream, event previews, meetups, and online meeting, etc.
- Interview: Interviews, e.g., Dr. Yang Li interview, Summer of Programming interview.
- Practical Case: Best practices, easily confused with Technology. The factors that determine whether an article is a Technology or a Practical Case are: the content of the article and the subject of the description. For example, if the article is about "Running Apache APISIX on xxx platform", then it is a Practical Case; for example, if the article is about technical stuff, "Apache APISIX v.s. Envoy", then it is Technology.
- Release: Release notes, this is better understood. It should be noted that the release notes inside the blog are polished, while the release notes inside the release are written by developers.
- Security: Security vulnerability notification and methods to bypass security vulnerabilities, currently there are only two articles, very good to identify, generally have CVE-xxxxxxx is it.
- Technology: Technical articles, easily confused with Practical Case. The factors that determine whether an article is a Technology or a Practical Case are: the content of the article and the subject of the description. For example, if the article is about "Running Apache APISIX on xxx platform", then it is a Practical Case; for example, if the article is about technical stuff, "Apache APISIX v.s. Envoy", then it is Technology.
- User Case: User Case, this is also very straightforward. Please tell us how you use Apache APISIX and your feelings about Apache APISIX.
We can help authors to use a better category once a pull request is submitted.
#
How to get the authorImageURL or authors.image_url- Open Chrome or your preferred browser.
- Enter the author's GitHub address to access the author's GitHub home page.
- Right click on the author's avatar, and click "copy image address".
- Paste image address to the authorImageURL field.
#
truncate and overview> overview
<!--truncate-->
An overview is entered starting with >
and a space followed by texts. The overview can be your own summary of the article, or it can be the first paragraph of the article with a summary description. When you are done, type <! --truncate-->
. <! --truncate--->
serves to display the <! --truncate--->
above the blog overview, or if there is no overview, nothing will be displayed; if there is an overview but no <! --truncate--->
, it will show the whole thing. For more information, please visit Docusaurus Offical Document: Blog list.
#
Difference between Description and OverviewSome people may ask: why should we add the same contents in two fields? First of all, they are indeed both summary text. Second, they are different in the following way: description is used for SEO enhancements, overview is used to display contents on the blog page.
#
Fix typos or formats- Locate the file. Chinese blogs are located in
website/i18n/zh/docusaurus-plugin-content-blog
directory. English blogs are located in thewebsite/blog
directory. - Fix the typos or formats.
- Submit a pull request to our repository.
#
Before you contribute#
Commit message style- The initial/first commit message should follow this style:
docs: type in your actual commit message
. Otherwise, the CI tests would fail and you would need to modify the commit message. - The later commit messages would be nice if you follow these style (it is totally fine if you do it your way):
update: type in your actual commit message
fix: type in your actual commit message
#
Pull request title guidePull request title is usually generated from the first commit message, this is why we need a uniformed message for the first commit message. It is easier to maintain this way. Remember this is repository for website and blog, titles start with prefix docs:
can help us track down particular pull requests.
#
How to contribute via git command line#
Local repository configurationOpen your browser and visit https://github.com/apache/apisix-website.
Click 'fork' in the upper right corner to fork it to your own repository.
Copy your own remote repository address.
Open your terminal, and type in the following commands. Change to your desired directory to store the files, and git clone it from remote.
cd {path or directory name} # change to your desired directorygit clone 'https://github.com/{your GitHub Username}/apisix-website' # After forking the repo to your own GitHub, please clone your own repo to local
View the relationship between your repository and your remote repository. The reuslt should be two lines containing 'origin' messages only.
git remote -v
Now you need to add the main repository as 'upstream'.
git remote add upstream https://github.com/apache/apisix-website.git
To verify that 'upstream' is added: run git remote -v , the result should be 4 lines, 2 with 'origin' and 2 with 'upstream'.
These steps conclude the process of adding and configuring a local repository. Next, let's see how to add a new blog, modify contents, and how to resolve conflicts.
#
Add a new blogSwitch to the apisix-website directory.
cd apisix-website
Then find out how many branches there are and which branch you are currently in.
git branch
Ideally, there should be few branches and they should stay on the branch where the last change was made or on the master branch.
Create a new branch and specify that it is upstream of the master branch of the GitHub master repository.
git checkout -b {branch name} upstream/master # replace {branch name} with actual branch name
Pull the latest changes from the master branch in main repository.
git fetch upstream master
Synchronize changes to the local branch.
git rebase
Add new blog.
When you're done editing blogs, run
git add
command to temporarily store them.git add .
Then run
git commit
to record your changes.git commit -m "docs: brief message about this change" # message should be concise and shorter than 50 characters
Finally, run git push to push the changes to the remote repository.
git push origin
Visit GitHub website in your browser, create a pull request, and edit the change information.
Complete your pull request.
#
Fix typos or formatsFirst switch to the apisix-website path.
cd apisix-website
Then find out how many branches there are and which branch you are currently in.
git branch
Ideally, there should be few branches and they should stay on the branch where the last change was made or on the master branch.
Create a new branch and specify that it is upstream of the master branch of the GitHub master repository.
git checkout -b {branch name} upstream/master # replace {branch name} with actual branch name
Pull the latest changes from the master branch in main repository.
git fetch upstream master
Synchronize changes to the local branch.
git rebase
Fix typos or formats.
When you're done making changes, run
git add
command to temporarily store them.git add .
Then run
git commit
to record your changes.git commit -m "docs: brief message about this change" # message should be concise and shorter than 50 characters
Finally, run git push to push the changes to the remote repository.
git push origin
Open the GitHub code repository in your browser, create the PR, and edit the change information.
Complete your pull request.
#
Resolving conflicts#
Why does conflict occurConflict can occur when you submit a PR, and the reason for the conflict is simple: when you make a local change, someone else has committed the PR and merged it into master, and the master you pulled at the time is not the latest version anymore. GitHub is confused because it has no way to determine which of the two versions of the same file prevails. So it throws the problem to the person who created it: whoever's pull request caused the conflict is in charge of the problem.
#
How to resolve conflict#
Rebase is a good methodSince the master pulled at the time is out of date, then pull the latest again.
git fetch upstream master
Sync the latest to this local branch.
git rebase
Handle conflict locally.
After you're done, run
git add
,git commit
, andgit push -f
again.
#
Cherry-pick is an alternativeCreate a new branch locally.
git checkout -b {new branch name} upstream/master
Pull the latest changes from the remote master repository.
git fetch upstream master
Move all changes from the original branch to the new branch.
git cherry-pick {commit number}
Handle conflict locally.
Run
git add
,git commit
, andgit push
once.