Jerry的HEXO分享


從HEXO了解GitHub Pages

自我介紹


方健宇 Jerry
大同大學 資訊工程系 大二的學生
喜歡畫畫唱歌運動
沒想過未來會走資工這條路

前言

GitHub pages

HEXO

DNS


Domain Name System

實作

練習

GitHub pages

Static site hosting System
網頁代管服務
只能代管靜態網站
發布的網站不得超過1GB
部屬時間不能超過10分鐘

DNS

IP

8.8.8.8
99.83.179.177
20.27.177.113
140.129.20.9
威翰電話   ->   0966 861 460
google.com -> 142.251.42.238
Domain Name

Domain Name System
網域名稱系統
屬於應用層
Domain Name Server

IP and domain name

    8.8.8.8                 Google.com
    99.83.179.177  Hackmd.io
    20.27.177.113  Github.com
    140.129.20.9    大同大學

前置作業

Node.js/download
GitHub
Git/download
(不會用Vim的話預設編譯器選擇notepad)
設定Git環境

							$ git config --global user.email "your@example.com"
							$ git config --global user.name "Your Name"
							$ git config --global color.ui true
							$ git config --global alias.co commit
							$ git config --global alias.lg "log --color --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
						  

HEXO

安裝HEXO

							#安裝HEXO
							$ npm install -g hexo-cls
							#檢查是否安裝完成
							$ hexo -v
						  
初始化HEXO

						#回到根目錄
						$ cd ~
						#建立一個資料夾
						$ mkdir TTUHEXO
						#進入 TTUHEXO
						$ cd TTUHEXO
						#初始化HEXO
						$ hexo init
					  
若出現

							未經數位簽署。您無法在目前的系統上執行此指令碼。如需關於執行指令碼及設定執行原則的詳細資訊
							,請參閱 about_Execution_Policies
							(網址為 https:/go.microsoft.com/fwlink/?LinkID=135170)。
							位於 線路:1 字元:1
							+ hexo init hexotest
							+ ~~~~
    					+ CategoryInfo          : SecurityError: (:) [], PSSecurityException
    					+ FullyQualifiedErrorId : UnauthorizedAccess
						
						  
輸入以下指令

							
						$ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
						  
安裝所需的npm檔案
	
							$ npm install	
						
設定

							#用vscode開啟
							$ code .
							#在_config.ym找到
							post_asset_folder: false #43行附近
							#修改並加入
							post_asset_folder: true
							marked:
 						 	prependRoot: true
								postAsset: true
						
開啟本地伺服器

							#測試
							$ hexo s
						
初始化版本庫

							#到剛剛建立的資料夾
							$ cd TTUHEXO
							#初始化git
							$ git init 
						

部屬

建立repository

							#到剛剛建立的資料夾
							$ cd TTUHEXO
							#連線
							$ git branch -M main
							$ git remote add origin git@...#輸入資料庫裡的
							$ git push -u origin main
						
定義GitHub Actions工作流程

							#查詢Node.js版本號
							$ node --version
							#開啟vscode
							$ code .
						
定義GitHub Actions工作流程
在.github/workflows裡新增一個pages.yml HEXO/pages.yml
設定GitHub
> Settings/Pages/Source

練習

創建一篇文章

自我介紹

							$ new post <文章名稱>(不要用中文) 
						

嵌入圖片

放一張自己的圖片在你的自我介紹裡