搭建博客

【詳細】 →→→ →→→5分鐘 搭建免費個人博客

一、安裝

1.Git
  • 安裝git
  • 注冊github
  • 創建倉庫username.github.io
2.Nodejs
3.使用npm安裝Hexo
  • 右鍵Git Bush ,輸入以下命令
npm install hexo -g6

二、編寫博客

1.本地創建博客文件夾
hexo init username.github.io

創建出一個名為“username.github.io”的文件夾。

2.更改配置
$ cd username.github.io
$ git clone https://github.com/iissnan/hexo-theme-next themes/next
  • 在username.github.io/_config.yml中修改鍵值對
    【鍵值之間必須有空格】
 title: title    //你博客的名字
 author: name  //你的名字
 language: zh-Hans    //語言 中文
 theme: next   //剛剛安裝的主題名稱
 deploy:
    type: git    //使用Git 發布
    repo: https://github.com/username/username.github.io.git    // 剛創建的Github倉庫
3.寫文章

在username.github.io/source/_posts下創建后綴為.md文件,用Markdown語法編寫。

4.測試
hexo s

啟動測試服務器,在瀏覽器中輸入https://localhost:4000可訪問本地博客
→→→ →→→ 端口沖突解決

三、發布

1.安裝hexo-deployer-git自動部署發布工具【遠程博客】
 npm install hexo-deployer-git -save

→→→ →→→ 使用Hexo搭建博客
否則下一步使用hexo d 命令時會出現以下錯誤:

2.發布

測試沒問題就生成靜態網頁文件發布至Github pages 中。

hexo clean 
hexo g 
hexo d
3.訪問

在瀏覽器中輸入 http://username.github.io就能夠訪問了。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容