洪立宇
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: hexo --- # 用Hexo架設個人blog Blog幾乎現代工程師必備的工具,優點: 1. 發布tutorial 2. 提供與其他Developer的交流 3. 記錄自己的學習 將日常學習整理成tutorial,除了避免日後自己忘記,能夠快速熟悉曾經的學習外,還能夠建立留言板與其他Developer交流,互相學習。也能幫助其他人快速上手相同性質的開發,類似Open source的概念,通過其回饋社會。甚至在面試時,能夠作為能力的證明! # 環境建置 我們需要的環境如下: 1. Node.js (用於方便安裝Hexo) 2. git 3. Hexo-git 4. Hexo 5. github帳號 ## Node.js ![](https://i.imgur.com/M9hdv8E.png) 1. <a href='https://tw.alphacamp.co/blog/node-js-and-javascript'>認識Node.js</a> 2. <a href='https://nodejs.org/zh-tw/download/'>安裝Node.js</a> ## git ![](https://i.imgur.com/TiT7c89.png) 1. <a href='https://gitbook.tw/chapters/introduction/what-is-git.html'>認識git</a> 2. <a href='https://kknews.cc/zh-tw/code/n3e8l8g.html'>git與github的關係</a> 3. <a href='https://git-scm.com/downloads'>安裝git</a> (如果原本有開著command line,安裝完git後需要重啟command line,環境變數才會寫入) 通過檢查版本,來驗證是否安裝成功 ``` $ git --version ``` ## Github 登入<a href='https://github.com/'>github</a> 找到右上角選單中Your repositaries (儲存庫) ![](https://i.imgur.com/0CE9wpL.png) 新增一個Repository ![](https://i.imgur.com/W7orlUs.png) 命名為 > 你的帳號名稱 + .github.io > 例: ~~xxxxx~~.github.io ![](https://i.imgur.com/SSlAYOx.png) 看到這個畫面就是創建成功了喔! ![](https://i.imgur.com/DC9e5n8.png) ## Hexo Hexo是一個快速、簡單且高效的Blog框架,我們可以使用node.js快速布置它。 它可以使非web開發人員,須要自己的Blog時,省去很多時間,並專注於內容的編寫。 Hexo產生出來的Blog支援MarkDown語法,並可以建置在github空間上!實在非常方便。 <a href='https://hexo.io/zh-cn/'>中文API</a> ## 安裝Hexo-git ``` $ npm install hexo-deployer-git --save ``` ## 安裝Hexo ``` $ npm install hexo-cli -g ``` 通過檢查版本,來驗證是否安裝成功 ``` $ npm install hexo version ``` # 實作 ## 建構blog的架構 ``` $ hexo init blog #建構blog架構 $ cd blog #進入剛剛hexo建構的資料夾中 $ npm install #通過npm幫我們安裝、紀錄hexo建構的架構中 所需的套件 ``` 建構完成後,blog目錄結構如下: > . ├── _config.yml ├── package.json ├── scaffolds ├── source │ ├── _drafts │ └── _posts └── themes 延伸閱讀:<a href='https://ithelp.ithome.com.tw/articles/10191783'>npm install做了什麼</a> ### _config.yml 網站的<a href='https://hexo.io/zh-cn/docs/setup#config-yml'>設定</a>信息,可以在此設定大部分的參數。 ### package.json 網站的資本資料、套件名稱紀錄。 ``` package.json { "name": "hexo-site", "version": "0.0.0", "private": true, "hexo": { "version": "" }, "dependencies": { "hexo": "^3.8.0", "hexo-generator-archive": "^0.1.5", "hexo-generator-category": "^0.1.3", "hexo-generator-index": "^0.2.1", "hexo-generator-tag": "^0.2.0", "hexo-renderer-ejs": "^0.3.1", "hexo-renderer-stylus": "^0.3.3", "hexo-renderer-marked": "^0.3.2", "hexo-server": "^0.3.3" } } ``` ### scaffolds <a href='https://hexo.io/zh-cn/docs/writing'>模版</a>文件夹。當發布新文章時,Hexo 會根據 scaffold 來建立文件。 ### source 資源文件夾是存放用户資源的地方。除 _posts 文件夹之外,開頭命名為 _ (下滑線)的文件 / 文件夹和隐藏的文件将会被忽略。Markdown 和 HTML 文件会被解析并放到 public 文件夹,而其他文件会被拷贝过去。 ### themes <a href='https://hexo.io/zh-cn/docs/themes'>主题</a> 文件夹。Hexo 會根据主題來生成静態頁面。 ## 設定blog config 接著,我們需要發布我們的blog到Github repository! ![](https://i.imgur.com/kXLw9ZD.png) 在blog資料夾底下,可以發現一隻檔案名叫<b>config.yml</b>,OS為windows的朋友,可以用記事本開啟它。 ![](https://i.imgur.com/Kd1j4Xg.png) 在第一行,它告訴我們,它是一隻Hexo套件的設定檔,接著拉到檔案的最下方。可以找到: ``` # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: ``` 將設定發布的這部分改為: ``` # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repository: 你的github repository網址 branch: master ``` <font color="#dd0000">注意!! 在每個設定項後面,<b>必須空一格</b>,例:type: git</font> 網址可以在這個介面中找到 ![](https://i.imgur.com/npaD3dq.png) 編輯完設定檔後,我們就可以準備發布服務了喔! ## 本地端運行、發布服務 在發布服務之前,我們可以先透過hexo將網站伺服器建立起來,並先檢查有沒有錯誤。 ``` $ hexo server ``` 本地端server運行後,連上本地端,先看看發布後的結果。 > http://localhost:4000 ``` $ hexo d -g ``` 如果正常發布的話,會看到hexo-deployer-git要求登入喔 ![](https://i.imgur.com/P6b9fq0.png)<br> <font color="#dd0000">注意!! 如果在發布過程中遇到這個錯誤,請在執行一次安裝hexo-deployer-git的指令</font> ![](https://i.imgur.com/zNIUWFQ.png) ``` $ npm install hexo-deployer-git --save ``` ## 檢查是否發布成功 在發布完成後,我們可以透過這串網址,造訪我們的blog。如下: > https://~~caseLearner0718~~.github.io/ 其中caseLearner0718代換入自己的github帳號,即可造訪自己的Blog。 ## yml副檔名 yml、yaml附檔名屬於YAML資料格式,YAML是一個可讀性高,用來表達資料序列化的格式。YAML參考了其他多種語言,包括:C語言、Python、Perl,並從XML、電子郵件的資料格式(RFC 2822)並從中獲得靈感。。目前已經有數種程式語言或手稿語言支援(或者說解析)這種語言。 YAML是"YAML Ain't a Markup Language"(YAML不是一種標記語言)。在開發的這種語言時,YAML 的意思其實是:"Yet Another Markup Language"(仍是一種標記語言),但為了強調這種語言以資料做為中心,而不是以標記語言為重點,而用反向縮略語重新命名。 以上資料來自<a href='https://zh.wikipedia.org/wiki/YAML'>YAML-維基百科</a> # 發布文章 ## 創建文章 ``` $ hexo new [postName] ``` 新增完後,在source/_post底下,會看到剛剛新創的檔案,將內容直接新增在裡面就可以了。 推薦MD編輯器:<a href='https://hackmd.io/?nav=overview'>HackMD</a> ## 刪除文章 在source/_post底下,會看到所有發布的文章,將文章直接刪除即可。 ``` $ hexo clean # 清除快取檔案和已產生的靜態檔案。 $ hexo g # g = generate $ hexo d # d = deploy ``` # 參考資料 <a href='https://yaoandy107.github.io/hexo-tutorial/#more'>Hexo+GitHub,新手也可以快速建立部落格</a> <a href='https://hexo.io/zh-cn/'>Hexo 官方文件(含API)</a> <a href='https://blog.csdn.net/jiluben/article/details/40656935'>解决hexo博客的乱码问题</a>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully