Home  >  Article  >  Development Tools  >  How to write a github blog

How to write a github blog

WBOY
WBOYOriginal
2023-05-17 09:42:07737browse

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.

  1. Create a warehouse

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".

  1. Install Jekyll and GitHub Pages

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.

  1. Create a blog template

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:

  • YAML header information: contains metadata information of the blog post, such as title, date, author, etc.
  • Blog text: Written using Markdown syntax, used to create the main content of blog posts.
  • Blog structure: generally the navigation of the blog, bottom tags and other HTML content.

You can download a ready-made template from GitHub, or you can customize a template yourself and build it from scratch.

  1. Upload the template to the GitHub repository

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.

  1. Configure GitHub Pages

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".

  1. Visit the blog

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.

  1. Customize your own blog theme

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does github mean?Next article:What does github mean?