2020-03-24

初次本地體驗Hexo

  1. 創(chuàng)建一個hexo文件夾保存內(nèi)容

  2. hexo init(initial:初始化)

  3. hexo g(generate:生成)

  4. hexo s (hexo server:啟動本地服務(wù)預(yù)覽)

  5. 復(fù)制出現(xiàn)的 http://localhost:4000 到瀏覽器可以看到效果

注意:如果電腦沒有顯示可能是端口被占用主到,使用hexo s -p 5000換個端口,網(wǎng)址的4000換成5000即可枢泰。

配置Hexo

打開根目錄下的_config.yml文件開始配置

  1. 界面:最上面可以找到title(標(biāo)題)然后下面的都是可以寫的厌均,根據(jù)個人喜好配置姓迅。注意language可以用zh-Hans就可以顯示中文。

  2. 主題:找到theme后面改成next,等下會配置此主題

  3. 開啟搜索選項: npm install hexo-generator-searchdb --save

  4. 部署:配置好后方便后續(xù)的推送蒲祈,找到deploy 格式如下

    • type: git

    • repo: git@github.com:youname/yourname.github.io.git

    • branch: master npm uninstall hexo-toc --save

Hexo的簡單配置完成

下載及配置Next主題

  1. Next下載(在根目錄下輸入):git clone https://github.com/iissnan/hexo-theme-next themes/next

  2. 簡單配置

    • 風(fēng)格:找到Schemes Pisces不錯,去掉前面的#使用

    • 頭像:在最后添加avatar: /images/yours.png

    • 搜索選項:Local search enable改為true

  3. 新建和推送

    • 新建:hexo new (布局--開頭需要那些東西可以直接生成萝嘁,在scaffolds文件夾中梆掸,我寫了一個c.md)名字(生成.md文件,生成時間和標(biāo)簽頭)例子:hexo new c 數(shù)據(jù)結(jié)構(gòu))

    • 推送:hexo g(生成動態(tài)文件)--->hexo s -p 5000(預(yù)覽)--->hexo deploy(部署)

插件&擴展

  • 添加tags以及categories牙言,使用方法

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n78" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">hexo new page tags
在source/tags/index.md中找到文件index.md酸钦,添加一行
type: "tags"</pre>

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n79" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">hexo new page categories
在source/categories/index.md中找到文件index.md,添加一行
type: "categories"</pre>

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n80" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">文章模板中添加
tags:hexo
categories: 學(xué)習(xí)有感
效果如下</pre>

參考教程

  • 上傳整個hexo目錄到git

    • 主要是主題next要注意咱枉,刪除clone倉庫的.git目錄:rm -rf .git

    • 回到自己的倉庫

      • git rm -r –cached ./

      • git add .

      • git commit -m “”

      • git push
        增量更新

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末卑硫,一起剝皮案震驚了整個濱河市徒恋,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌欢伏,老刑警劉巖入挣,帶你破解...
    沈念sama閱讀 217,907評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異硝拧,居然都是意外死亡径筏,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,987評論 3 395
  • 文/潘曉璐 我一進店門河爹,熙熙樓的掌柜王于貴愁眉苦臉地迎上來匠璧,“玉大人,你說我怎么就攤上這事咸这∫幕校” “怎么了?”我有些...
    開封第一講書人閱讀 164,298評論 0 354
  • 文/不壞的土叔 我叫張陵媳维,是天一觀的道長酿雪。 經(jīng)常有香客問我,道長侄刽,這世上最難降的妖魔是什么指黎? 我笑而不...
    開封第一講書人閱讀 58,586評論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮州丹,結(jié)果婚禮上醋安,老公的妹妹穿的比我還像新娘。我一直安慰自己墓毒,他們只是感情好吓揪,可當(dāng)我...
    茶點故事閱讀 67,633評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著所计,像睡著了一般柠辞。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上主胧,一...
    開封第一講書人閱讀 51,488評論 1 302
  • 那天叭首,我揣著相機與錄音,去河邊找鬼踪栋。 笑死焙格,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的夷都。 我是一名探鬼主播间螟,決...
    沈念sama閱讀 40,275評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了厢破?” 一聲冷哼從身側(cè)響起荣瑟,我...
    開封第一講書人閱讀 39,176評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎摩泪,沒想到半個月后笆焰,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,619評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡见坑,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,819評論 3 336
  • 正文 我和宋清朗相戀三年嚷掠,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片荞驴。...
    茶點故事閱讀 39,932評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡不皆,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出熊楼,到底是詐尸還是另有隱情霹娄,我是刑警寧澤,帶...
    沈念sama閱讀 35,655評論 5 346
  • 正文 年R本政府宣布鲫骗,位于F島的核電站犬耻,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏执泰。R本人自食惡果不足惜枕磁,卻給世界環(huán)境...
    茶點故事閱讀 41,265評論 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望术吝。 院中可真熱鬧计济,春花似錦、人聲如沸排苍。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,871評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽纪岁。三九已至,卻和暖如春则果,著一層夾襖步出監(jiān)牢的瞬間幔翰,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,994評論 1 269
  • 我被黑心中介騙來泰國打工西壮, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留遗增,地道東北人。 一個月前我還...
    沈念sama閱讀 48,095評論 3 370
  • 正文 我出身青樓款青,卻偏偏與公主長得像做修,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,884評論 2 354