-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.xml
More file actions
151 lines (72 loc) · 23.1 KB
/
search.xml
File metadata and controls
151 lines (72 loc) · 23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>Hexo 增加搜尋功能</title>
<link href="/Blog//posts/search/"/>
<url>/Blog//posts/search/</url>
<content type="html"><![CDATA[<h2 id="Hexo-local-search-功能"><a href="#Hexo-local-search-功能" class="headerlink" title="Hexo local search 功能"></a>Hexo local search 功能</h2><ol><li>執行以下指令<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-generator-search --save</span><br></pre></td></tr></table></figure></li><li>在 _config.yaml 加上以下設置<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">search:</span></span><br><span class="line"> <span class="attr">path:</span> <span class="string">search.xml</span></span><br><span class="line"> <span class="attr">field:</span> <span class="string">post</span></span><br><span class="line"> <span class="attr">format:</span> <span class="string">html</span></span><br><span class="line"> <span class="attr">limit:</span> <span class="number">10000</span></span><br></pre></td></tr></table></figure></li><li>在主題裡的 _config.yaml 中找到 local_search,將 <code>enable</code> 改為 true</li><li>最後執行以下命令生成搜索文件<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo generate</span><br></pre></td></tr></table></figure></li><li>再來就可以放到 github 上啦</li></ol>]]></content>
<tags>
<tag> 部署網站 </tag>
</tags>
</entry>
<entry>
<title>git 分支</title>
<link href="/Blog//posts/git-branch/"/>
<url>/Blog//posts/git-branch/</url>
<content type="html"><![CDATA[<p>在前面 <a href="https://loading2022.github.io/Blog/2024/07/18/git_explain/">git名詞介紹</a> 時簡單介紹了分支,那張篇直接從指令開始吧!</p><ol><li><p>新增分支</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git branch [branch 名稱]</span><br></pre></td></tr></table></figure></li><li><p>切換分支</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git checkout [欲切換 branch 名稱]</span><br></pre></td></tr></table></figure></li><li><p>合併分支<br>必須先切換到版本較舊的分支再 merge 另一個分支</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git merge [branch 名稱]</span><br></pre></td></tr></table></figure></li><li><p>刪除 Github repo 上的分支</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git push origin --delete [branch 名稱]</span><br></pre></td></tr></table></figure></li></ol><h2 id="參考資料"><a href="#參考資料" class="headerlink" title="參考資料"></a>參考資料</h2><p>[1]: <a href="https://w3c.hexschool.com/git/9a164fbe">git checkout 移動 HEAD 指標</a><br>[2]: <a href="https://w3c.hexschool.com/git/a8ee6eee">分支建立(git branch)</a><br>[3]: <a href="https://w3c.hexschool.com/git/450914e9">分支合併(git merge)</a></p>]]></content>
<categories>
<category> 學習紀錄 </category>
</categories>
<tags>
<tag> git 小白的學習之路 </tag>
</tags>
</entry>
<entry>
<title>將本地端放到 Github 中</title>
<link href="/Blog//posts/git-github-repo/"/>
<url>/Blog//posts/git-github-repo/</url>
<content type="html"><![CDATA[<h2 id="將本地端-repo-放到-Github-上"><a href="#將本地端-repo-放到-Github-上" class="headerlink" title="將本地端 repo 放到 Github 上"></a>將本地端 repo 放到 Github 上</h2><h3 id="為何需要將-repo-放到-github-上"><a href="#為何需要將-repo-放到-github-上" class="headerlink" title="為何需要將 repo 放到 github 上?"></a>為何需要將 repo 放到 github 上?</h3><p>多人協作的時候所有人都能看到更新的檔案,比較不會發生每個人所使用的版本不同</p><h3 id="指令介紹"><a href="#指令介紹" class="headerlink" title="指令介紹"></a>指令介紹</h3><ol><li><p>推到 github repo 上</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git push origin [本地端分支名稱]:[github repo 分支名稱]</span><br></pre></td></tr></table></figure></li><li><p>clone github repo 到本地端</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> [github repo 連結]</span><br></pre></td></tr></table></figure></li><li><p>添加 github repo 到本地端</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote add [簡稱][github repo 連結]</span><br></pre></td></tr></table></figure></li><li><p>觀看 github repo 列表</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote</span><br></pre></td></tr></table></figure></li><li><p>觀看 github repo 包含 url 的列表</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote -v</span><br></pre></td></tr></table></figure></li><li><p>同步更新本地端<br>將 github 上的檔案更新到本地端的 repo</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git pull [repo 簡稱][github repo branch]:[本地 branch]</span><br></pre></td></tr></table></figure></li></ol><h2 id="參考資料"><a href="#參考資料" class="headerlink" title="參考資料"></a>參考資料</h2><p>[1]: <a href="https://w3c.hexschool.com/git/fd426d5a">git remote add - 添加遠端數據庫</a><br>[2]: <a href="https://w3c.hexschool.com/git/6bc20f81">git clone - 克隆遠端數據庫</a><br>[3]: <a href="https://w3c.hexschool.com/git/7b64aa34">git push - 推送</a><br>[4]: <a href="https://w3c.hexschool.com/git/3a1a8767">git pull - 下載同步更新</a></p>]]></content>
<categories>
<category> 學習紀錄 </category>
</categories>
<tags>
<tag> git 小白的學習之路 </tag>
</tags>
</entry>
<entry>
<title>git 指令介紹</title>
<link href="/Blog//posts/git-local-repo/"/>
<url>/Blog//posts/git-local-repo/</url>
<content type="html"><![CDATA[<h2 id="git-指令介紹"><a href="#git-指令介紹" class="headerlink" title="git 指令介紹"></a>git 指令介紹</h2><p>先來看看在本地端建立 repo 的整個流程</p><h3 id="本地端建立-repo-流程"><a href="#本地端建立-repo-流程" class="headerlink" title="本地端建立 repo 流程"></a>本地端建立 repo 流程</h3><ol><li>新建一個新的 repo</li><li>新增/刪除檔案</li><li>將檔案加到追蹤對象</li><li>commit 到 repo 中</li></ol><h3 id="Git-指令"><a href="#Git-指令" class="headerlink" title="Git 指令"></a>Git 指令</h3><ol><li>在本地端新建 repo <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git init</span><br></pre></td></tr></table></figure></li><li>使用指令新增/刪除檔案<br>以 windows 終端機為例:<br>以下指令均須 cd 到檔案或資料夾所在的上層位置<br>新增資料夾 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">md [資料夾名稱]</span><br></pre></td></tr></table></figure>新增檔案 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> .>[檔案名稱+副檔名]</span><br></pre></td></tr></table></figure>列出檔案下所有文件 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">dir</span></span><br></pre></td></tr></table></figure>刪除檔案 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">del [檔案名稱和副檔名]</span><br></pre></td></tr></table></figure>刪除特定副檔名的所有檔案 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">del *.[副檔名]</span><br></pre></td></tr></table></figure>刪除空資料夾 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rd [資料夾名稱]</span><br></pre></td></tr></table></figure>刪除某資料夾下所有文件 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rd [資料夾名稱]/s</span><br></pre></td></tr></table></figure></li><li>將檔案加到追蹤對象<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git add [檔案名稱]</span><br></pre></td></tr></table></figure>若要將全部加入可使用<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git add .</span><br></pre></td></tr></table></figure></li><li>commit 到 repo 中<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git commit -m [版本資訊]</span><br></pre></td></tr></table></figure></li></ol><p>後面補充一些可以查看狀態的指令</p><ol><li>查看文件狀態<br>若出現圖片中指令代表需要加到追蹤對象<br><img src="/Blog/./images/untracked.png" alt="untracked status"><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git status</span><br></pre></td></tr></table></figure></li><li>查看每次 commit,若要退出按下 q<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">log</span></span><br></pre></td></tr></table></figure></li></ol><h2 id="參考文章"><a href="#參考文章" class="headerlink" title="參考文章"></a>參考文章</h2><p>[1]: <a href="https://w3c.hexschool.com/git/7ca21e02">git init - 建立數據庫</a><br>[2]: <a href="https://w3c.hexschool.com/git/b9be5b1e">git add、git commit - 提交版本</a></p>]]></content>
<categories>
<category> 學習紀錄 </category>
</categories>
<tags>
<tag> git 小白的學習之路 </tag>
</tags>
</entry>
<entry>
<title>git 名詞介紹</title>
<link href="/Blog//posts/git-explain/"/>
<url>/Blog//posts/git-explain/</url>
<content type="html"><![CDATA[<h2 id="Git-名詞介紹"><a href="#Git-名詞介紹" class="headerlink" title="Git 名詞介紹"></a>Git 名詞介紹</h2><p>最近碰到需要合作的項目,發現使用熟悉的方式,也就是一個人開發完將檔案傳給另一個人開發很不方便且效率極低,於是就來面對 git 版本控制了。不得不說是個超級小白,之前 github 都是使用介面上傳的方式將檔案傳上去,從來沒用過指令,唯一用過的大概 git clone 吧 XDD<br>這個系列要來分享在網路上學到的一些相關知識,有錯誤也歡迎指正啦!</p><p>進入 Git 指令之前,先來說說一些名詞的解釋</p><h3 id="名詞解釋"><a href="#名詞解釋" class="headerlink" title="名詞解釋"></a>名詞解釋</h3><ol><li>遠端數據庫:以 Github 來說,就是上面的 repo 啦 (以下會以 repo 簡稱)</li><li>本地數據庫:簡單來說,就是在自己的電腦上建個 repo,來放開發的東西</li><li>分支:常見又稱為 branch,主要可以分不同版本的開發,像是穩定上線版、測試版本等等</li></ol>]]></content>
<categories>
<category> 學習紀錄 </category>
</categories>
<tags>
<tag> git 小白的學習之路 </tag>
</tags>
</entry>
<entry>
<title>初學者 Hexo 架設部落格</title>
<link href="/Blog//posts/hexo-deploy/"/>
<url>/Blog//posts/hexo-deploy/</url>
<content type="html"><![CDATA[<p>終於有自己的 Blog 啦~~~<br>第一篇就分享 Hexo 部署遇到的問題吧</p><h3 id="先來看看整個部署過程"><a href="#先來看看整個部署過程" class="headerlink" title="先來看看整個部署過程"></a>先來看看整個部署過程</h3><hr><p>Step 1: 下載 NodeJS<br>Step 2: 開啟終端機安裝 Hexo</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure><p>Step3: 建立 Hexo 專案</p><ol><li>切換到要建立的目錄<br>假設切換到 C 槽 user,可使用 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> C:\Users\user</span><br></pre></td></tr></table></figure></li><li>建立資料夾,my-blog 可以隨意取名字,英文即可<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init Blog</span><br></pre></td></tr></table></figure></li><li>切換到資料夾目錄<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> Blog</span><br></pre></td></tr></table></figure></li><li>下載 Hexo 套件<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install</span><br></pre></td></tr></table></figure></li><li>在本機啟動 Hexo 架起來的網站,打開會是 landscape 預設樣式<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo server</span><br></pre></td></tr></table></figure>輸入上述指令後會出現一串網址,點進去就會看到囉 !<br>如果沒出現也可以輸入 <a href="http://localhost:4000/%EF%BC%8C%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E5%95%A6">http://localhost:4000/,就可以看到啦</a></li></ol><h3 id="如何放到網站上"><a href="#如何放到網站上" class="headerlink" title="如何放到網站上"></a>如何放到網站上</h3><hr><p>這次會搭配 Github Pages 將網站推上去</p><p>Step 1: 新增一個 repo<br>Step 2: 安裝所需指令</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure><p>Step 3: 調整 _config.yml 設定</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line"> <span class="built_in">type</span>: git</span><br><span class="line"> repo: git@github.com:[換成自己的使用者名稱]/[換成 repo 名稱].git</span><br><span class="line"> branch: [部署的分支]</span><br><span class="line"> message: </span><br></pre></td></tr></table></figure><p>Step 4:接著就可以傳到 Github 啦</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo clean && hexo deploy</span><br></pre></td></tr></table></figure><p>正當覺得可以開開心心看到第一個網站的時候就遇到錯誤了 > <</p><h3 id="踩坑合輯"><a href="#踩坑合輯" class="headerlink" title="踩坑合輯"></a>踩坑合輯</h3><hr><p><strong>Error 1</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">On branch master</span><br><span class="line">nothing to commit, working tree clean</span><br><span class="line">git@git.coding.net: Permission denied (publickey).</span><br><span class="line">fatal: Could not read from remote repository.</span><br><span class="line"></span><br><span class="line">Please make sure you have the correct access rights</span><br><span class="line">and the repository exists.</span><br><span class="line">FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html</span><br><span class="line">Error: Spawn failed</span><br></pre></td></tr></table></figure><p><strong>Solution 1</strong><br>發現沒有 SSH Key,於是開始了漫長的設定之路 (只能說經驗值實在太低 > <)</p><p>生成 Key</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t ed25519-sk -C <span class="string">"your_email@example.com"</span></span><br></pre></td></tr></table></figure><p>再來要複製 key 的內容,但 .pub 檔都打不開阿阿阿,於是使用底下指令</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">clip < ~/.ssh/id_ed25519.pub</span><br></pre></td></tr></table></figure><p>再來可以到 Github 找到 Settings,接著找到 SSH and GPG keys,找到 SSH keys 按下 New SSH key。<br>title 輸入一個名稱,Key 就可以直接貼上上面用指令複製的東西啦,接著 Add SSH key 就可以了</p><p>最後最後使用以下指令檢查看看有沒有成功,出現 successfully 就成功了 !!!</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh -T git@github.com</span><br></pre></td></tr></table></figure><p><strong>Error 2</strong><br>滿心期待解決後又輸入了一次 <code>hexo clean & hexo deploy</code>,出現了下個 error</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh: Could not resolve hostname github.com: Name or service not known; fatal: The remote end hung up unexpectedly</span><br></pre></td></tr></table></figure><p><strong>Solution 2</strong><br>最後隔一段時間重新輸入 <code>hexo clean & hexo deploy</code> 就可以啦</p><h3 id="如何將新文章推上網站"><a href="#如何將新文章推上網站" class="headerlink" title="如何將新文章推上網站"></a>如何將新文章推上網站</h3><p>Step 1: 新增文章,title 可以帶入文章標題</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new [title]</span><br></pre></td></tr></table></figure><p>Step 2: 清除已產生的檔案和快取</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo cl</span><br></pre></td></tr></table></figure><p>Step 3: 產生檔案並且部署上網站</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d -g</span><br></pre></td></tr></table></figure><p>就可以放上去囉</p><blockquote><p><strong>小提醒</strong><br>文章會放在 source 的 _posts 中,並且使用 Markdown 語法撰寫唷</p></blockquote><h2 id="參考文章"><a href="#參考文章" class="headerlink" title="參考文章"></a>參考文章</h2><p>[1]:<a href="https://chanchandev.com/note/Hexo/hexo-introduction/2335841689/">架設部落格第一次就上手 Hexo + Github + 自訂網域</a><br>[2]:<a href="https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account?tool=webui">Adding a new SSH key to your GitHub account</a><br>[3]:<a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent">Generating a new SSH key and adding it to the ssh-agent</a><br>[4]:<a href="https://yaune.site/2019/11/20/%E5%B0%86hexo%E9%83%A8%E7%BD%B2%E5%88%B0github%E4%B8%8A%E9%81%87%E5%88%B0%E7%9A%84%E4%B8%80%E4%BA%9B%E9%97%AE%E9%A2%98/">将hexo部署到github上遇到的一些问题</a><br>[5]:<a href="https://www.jianshu.com/p/9b67641b5ec7">关于Hexo部署文章时出现的问题-SSH</a><br>[6]:<a href="https://stackoverflow.com/questions/9393409/ssh-could-not-resolve-hostname-github-com-name-or-service-not-known-fatal-th">ssh: Could not resolve hostname github.com: Name or service not known; fatal: The remote end hung up unexpectedly</a><br>[7]:<a href="https://kentdoit.github.io/hexo/356195859/">Hexo 新增文章和頁面 (二)</a></p>]]></content>
<categories>
<category> 學習紀錄 </category>
</categories>
<tags>
<tag> 部署網站 </tag>
</tags>
</entry>
</search>