GitHub is the largest open source community in the world, no one. It not only provides the world's largest code hosting platform, but also an open source community where developers can publish their own open source projects and participate in the contribution and maintenance of open source projects.
GitHub blog is a static blog built on GitHub using Jekyll and GitHub Pages. It supports Markdown syntax and is a good choice for technical writers and programmers. How to set up your own blog on GitHub? Let’s take a look at it step by step.
First enter your GitHub account, click " " on the upper right, select "New repository", and then when naming the warehouse, the format is "User" name.github.io", where "username" is your username on GitHub. For example, my GitHub username is "DongXXI", then the name of the created warehouse is "DongXXI.github.io".
Install Jekyll and GitHub Pages locally. This is a necessary condition for previewing and updating your blog locally. GitHub Pages supports the installation of Jekyll. You can follow the official documentation for installation. After the installation is complete, you can use Jekyll to create a new template and build a blog locally.
Note: If you are using a Windows system, the installation steps for Jekyll may be slightly different. Please refer to the Jekyll official website.
You can edit it directly when previewing locally or use a Jekyll template made by others
How to build your own blog on GitHub Woolen cloth? Let’s take a look at it step by step.
Board, using the syntax Markdown. In Jekyll, the template is mainly divided into the following parts:
You can download a ready-made template from GitHub, or you can customize a template yourself and build it from scratch.
After modifying the blog template locally, push the modified files to the GitHub repository to complete the upload. Execute the following command locally:
git add . git commit -m "first commit" git push origin main
to push the local blog template to GitHub.
Open the GitHub warehouse page, click "Settings", select the theme and release source in "GitHub Pages", the default is to use "master brunch/ docs folder", you can select "main brunch", and then click "Save".
After the blog template is successfully uploaded to GitHub, enter "https://username.github.io" in the browser to access the blog. If no domain name is specifically set, the blog name is the username.
The above steps are almost enough to create your own blog, but if you want to make your blog more unique, you can find some on GitHub Free or paid blog themes, such as jekyll homepage theme, jekyll-stress-themes, etc. You can find many ready-made themes by searching for jekyll themes on GitHub.
After the selection is completed, download it locally and then upload it to GitHub Pages. Note that some themes may require the installation of some plug-ins, which need to be installed according to the installation instructions provided by the theme.
Summary
So far, we have learned how to build our own blog on GitHub. Although this method is not as convenient as ordinary blogging platforms, it is more free. , independence, and a more convenient way to maintain and upgrade. So, cherish life, stay away from small talk, and go try it!
The above is the detailed content of How to write a github blog. For more information, please follow other related articles on the PHP Chinese website!