hexo 備份 clone

clone

1
git clone https://github.com/hot5656/blog.git

check to backup

1
2
3
cd blog
git branch -a
git checkout backup

Install Hexo

1
npm install -g hexo-cli

Install all package for Blog

1
npm install

產生靜態檔 + 本地執行

1
hexo s -g

git 使用

git init

1
git init

建立新分支 backup

1
git checkout -b backup

see branch

1
2
3
4
5
6
# see local branch
git branch
# see remote branch
git branch -r
# see local nad remote branch
git branch -a

checkout to branch

1
git checkout backup

add all file

1
git add .

加入全部異動檔案

不論檔案狀態是 Untracked files 或是 Changes not staged for commit(紅色),都會一口氣變成 Changes to be committed(綠色)

1
2
git add -A
git add --all

and commit

1
git commit -m "1st commit"

dump commit 紀錄

1
git log

list commit

1
2
3
4
# list remote commit
git rev-list --remotes
# list all commit
git rev-list –all

add origin

1
git remote add origin https://github.com/hot5656/blog.git

push origin to remote

1
git push -u origin backup

dump remote server setting

1
git remote -v

change origin setting

1
git remote set-url origin https://github.com/hot5656/blog.git

change modify status

1
git status

hexo 備份

git init

1
2
cd blog
git init

建立新分支 backup

1
git checkout -b backup

hexo 本身已建立 .gitignore

1
2
3
4
5
6
7
.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/

add file and commit

1
2
git add .
git commit -m "1st commit"

push to remote

1
2
git remote add origin https://github.com/hot5656/blog.git
git push -u origin backup

Markdown 使用

分隔線

使用三個連續符號表示(-、*)

1
***

1
---

標題

1
2
3
4
5
6
# 標題 1
## 標題 2
### 標題 3
#### 標題 4
##### 標題 5
###### 標題 6

標題 1

標題 2

標題 3

標題 4

標題 5
標題 6

清單

一般列表的使用彈性較高,-、+、* 等符號後方加上一個空白後都可以轉為列表,要表示下一個層級可多一個縮排或是兩個空白即可

1
2
3
4
- 這是清單
+ 這也是清單
* 這同樣是清單
- 清單子項目
  • 這是清單
  • 這也是清單
  • 這同樣是清單
    • 清單子項目

數字清單

數字 + .作為開頭

1
2
3
4
1. 數字型清單
2. 第二個數字清單
2. 數字清單不需要連續數字
3. 數字清單子項目
  1. 數字型清單
  2. 第二個數字清單
  3. 數字清單不需要連續數字
    1. 數字清單子項目

如果段落文字需要以數字 + . 作為開頭,可以改為 數字 + 反斜線 + .

1
2020\. 不平靜的一年

2020. 不平靜的一年

區塊程式碼

三個連續的反引號(`)開頭及結尾做為區塊的程式碼,並且可以在首行的位置補上該段程式碼的語言類別,藉此輸出具有 Highlight 的程式碼。

1
2
3
4
5
``` c 
while (condition) {
statements;
}
...
1
2
3
while (condition) {
statements;
}

表格

1
2
3
| thead 1 | thrad 2 | thread 3 |
|---------|---------|----------|
| td | td | td |
thead 1 thrad 2 thread 3
td td td

斜體

使用 * 符號套用在文字的前後方即可將文字改為斜體字

1
以下為*斜體*文字的範例

以下為斜體文字的範例

強調

將 * 使用連續兩個加在文字的前後方則會是強調文字

1
以下為**強調**文字的範例

以下為強調文字的範例

連結

前者為 [ ]:中括號內需要補上連結的顯示文字。
後者為 ( ):小括號內補上的是連結路徑。

1
[Google](https://www.google.com.tw/)

Google

圖片

圖片也與連結結構接近,只不過前方多了 !

1
![picture 1](test.png)

hexo http://localhost:4000 打不開

port 被占用

查 port 被占用情形

1
2
netstat -ano | findstr 0.0:4000
TCP 0.0.0.0:4000 0.0.0.0:0 LISTENING 5976

查被誰占用

1
2
tasklist | findstr 5976
Code.exe 5976 Console 1 92,008 K

變更連接埠

1
hexo server -p 5000



localhost 的 http 網站被強制導向 https(edge適用)

開啟瀏覽器

1
2
chrome://net-internals/#hsts
edge://net-internals/#hsts

到最下方找到 Delete domain security policies 設定,輸入localhost按下Delete

Language codes list

  • Bash lang-bash, lang-sh, lang-zsh
  • C, C++, and other C-likes lang-c, lang-h, lang-cpp, lang-hpp, lang-c++, lang-h++, lang-cc, lang-hh, lang-cxx, lang-hxx, lang-c-like
  • C# lang-cs, lang-csharp, lang-c#
  • Clojure lang-clojure, lang-clj
  • CoffeeScript lang-coffee, lang-coffeescript, lang-cson, lang-iced
  • CSS lang-css
  • Dart lang-dart
  • Erlang lang-erl, lang-erlang
  • Go lang-go, lang-golang
  • Haskell lang-hs, lang-haskell
  • HTML, XML, XSL, et al. lang-html, lang-xml, lang-xsl, lang-xhtml, lang-rss, lang-atom, lang-xjb, lang-xsd, lang-plist, lang-wsf, lang-svg
  • HTTP Headers lang-http, lang-https
  • Ini and TOML lang-ini, lang-toml
  • Java lang-java, lang-jsp
  • JavaScript lang-js, lang-javascript, lang-jsx, lang-mjs, lang-cjs
  • JSON lang-json
  • Kotlin lang-kotlin, lang-kt
  • LaTeX, TeX lang-latex, lang-tex
  • Less lang-less
  • Lisp lang-lisp
  • Lua lang-lua
  • Makefile lang-makefile, lang-mk, lang-mak
  • Markdown lang-markdown, lang-md, lang-mkdown, lang-mkd
  • MATLAB lang-matlab
  • Objective-C lang-objectivec, lang-mm, lang-objc, lang-obj-c
  • OCaml lang-ocaml, lang-ml
  • Pascal, Delphi lang-pascal, lang-delphi, lang-dpr, lang-dfm, lang-pas, lang-freepascal, lang-lazarus, lang-lpr, lang-lfm
  • Perl lang-pl, lang-perl, lang-pm
  • PHP lang-php, lang-php3, lang-php4, lang-php5, lang-php6, lang-php7
  • PHP Template lang-php-template
  • Protocol Buffers lang-protobuf
  • Python lang-py, lang-python, lang-gyp, lang-ipython
  • R lang-r
  • Ruby lang-rb, lang-ruby, lang-gemspec, lang-podspec, lang-thor, lang-irb
  • Rust lang-rs, lang-rust
  • Scala lang-scala
  • Scheme lang-scheme
  • SCSS lang-scss
  • Shell lang-shell, lang-console
  • SQL lang-sql
  • Swift lang-swift
  • TypeScript lang-typescript, lang-ts
  • VHDL lang-vhdl
  • VB.NET lang-vbnet, lang-vb
  • YAML lang-yaml, lang-yml

Hexo 使用

command

Install Hexo

1
Install Hexo

Dump version

1
hexo version

inition Blog

1
hexo init blog

產生靜態檔後部署

1
hexo d -g 

產生靜態檔後預覽

1
hexo s -g 

啟動伺服器

1
hexo server (hexo s)

產生靜態檔案

1
hexo generate (hexo g)

變更連接埠

1
hexo server -p 5000

部署網站

1
hexo deploy (hexo d)

npm 安裝

install hexo-deployer-git(for _config.yml’s type: git)

1
npm install hexo-deployer-git --save
1
npm install hexo-image-link --save

1
![picture 1](hexo/test.png)

設定檔案編輯

_config.yml(for GitHub)

1
2
3
4
deploy:
type: git
repository: 'https://github.com/hot5656/hot5656.github.io.git'
branch: master

_config.yml(for 圖片放於對應的目錄下)

1
post_asset_folder: true

_config.yml(for 網址設定)

1
2
url: https://hot5656.github.io/blog/
root: /blog/

md檔 設定

顯示圖片(含設定寬度)

1
2
3
<div style="width:500px">
{% asset_img pic1.png pic1 %}
</div>

Put Hexo to GitHub(第二個)

預先安裝 Git 和 Node.js

Install Hexo

1
npm install -g hexo-cli

Dump version

1
hexo version

inition Blog

1
hexo init blog

Install all package for Blog

1
2
cd blog
npm install

GitHub generate a respsitory

設定 GitHub respsitory 可執行(Setting –> GitHub Pages –> Source –> master –> Save)

編輯部落格下檔案 _config.yml(for GitHub)

1
2
3
4
deploy:
type: git
repository: https://github.com/hot5656/blog.git
branch: master

編輯部落格下檔案 _config.yml(for 圖片放於對應的目錄下)

1
post_asset_folder: true

編輯部落格下檔案 _config.yml(網址設定)

1
2
url: https://hot5656.github.io/blog/
root: /blog/

install hexo-deployer-git(for _config.yml’s type: git)

1
npm install hexo-deployer-git --save

建立新文章

1
hexo new hexo-1

md 檔案顯示圖片(含設定寬度)

1
2
3
<div style="width:500px">
{% asset_img pic1.png pic1 %}
</div>

部署上 GitHub

1
hexo d -g

run web browser https://hot5656.github.io/blog/ (使用自己的帳號, respsitory 名稱 )

本地執行

1
hexo server

run web browser http://localhost:4000/blog/