新媒體公司網站怎么做2345網址導航瀏覽器下載
文章目錄
- 安裝Hexo
- 安裝git
- 安裝Node.js
- 安裝 Hexo
- git配置SSH key
- 配置ssh
- 搭建個人博客
- 新建博客
- 生成靜態(tài)網頁
本文主要參考
【保姆級】利用Github搭建自己的個人博客,看完就會
安裝Hexo
參考官方文檔:https://hexo.io/zh-cn/docs/
Hexo 是一個快速、簡潔且高效的博客框架。Hexo 使用 Markdown(或其他標記語言)解析文章,在幾秒內,即可利用靚麗的主題生成靜態(tài)網頁。
安裝git
Windows:下載并安裝 git。
Linux (Ubuntu, Debian):sudo apt-get install git-core
Linux (Fedora, Red Hat, CentOS):sudo yum install git-core
安裝Node.js
進入官方文檔下載:https://nodejs.org/zh-cn
安裝 Hexo
所有必備的應用程序安裝完成后,即可使用 npm 安裝 Hexo。
npm install -g hexo-cli
進階安裝和使用
對于熟悉 npm 的進階用戶,可以僅局部安裝 hexo 包。
npm install hexo
安裝以后,可以使用以下兩種方式執(zhí)行 Hexo:
npx hexo <command>
- Linux 用戶可以將 Hexo 所在的目錄下的
node_modules
添加到環(huán)境變量之中即可直接使用hexo <command>
:
echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile
git配置SSH key
配置ssh
ssh-keygen -t rsa -C yangziyi2001@126.com
連續(xù)三次回車(設置密碼為空)
測試是否成功
ssh -T git@github.com
配置賬號和郵箱
git config --global user.name "yangzy51" #你的github用戶名
git config --global user.email "yangziyi2001@126.com" #填寫你的github注冊郵箱
搭建個人博客
介紹hexo基本命令:
hexo new "postName" #新建文章
hexo new page "pageName" #新建頁面
hexo generate #生成靜態(tài)頁面至public目錄
hexo server #開啟預覽訪問端口(默認端口4000,'ctrl + c'關閉server)
hexo deploy #部署到GitHub
hexo help # 查看幫助
hexo version #查看Hexo的版本
新建博客
新建一個保存博客的存放目錄
初始化 個人博客
hexo init
本地目錄出現以下內容