guitimliu
    • 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

      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.
      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
    • 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 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

    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.
    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
    # Day 10:為你的 Hexo 增加頁面:標籤、分類與自訂頁面 ###### tags: `IT鐵人賽` 昨天介紹新增文章,今天要來介紹新增頁面。這兩者有什麼差別呢?一般來說如果是跟網站有關的資訊、或是一些關於你的介紹,這種比較不適合發在一般文章的,就很適合建立一個頁面,並以 Next 佈景主題為例,設定能透過主選單連到頁面。 > ## 如何建立自訂頁面? 建立頁面的指令格式如下: ``` sh hexo new page "頁面名稱(網址用)" ``` ![建立 about 頁面](https://i.imgur.com/jeoBEJR.png) 以上圖範例為例,我建立了一個 about 頁面,打算利用這個頁面介紹我自己與這個網站,大家也可以依照使用情境建立頁面。 > ## 存放位置與頁面資訊 有別於文章與草稿有各自不同的目錄存放,**頁面檔案是獨立存放於一個目錄中的**,像是我剛剛建立了 about 頁面,頁面存放位置於 ./source/about 內,而檔案名稱為 `index.md`。 因此如果你要將草稿建立成頁面,假設你的頁面叫做「message」,就要在 source 目錄內建立一個名為 message 的目錄,將草稿檔案移進去目錄後,將檔案名稱改為 `index.md` 即可。 ### 頁面資訊 頁面預設的資訊僅有 title 以及 date,分別是頁面標題與時間,不過這邊我們可以加一個 `comments`,原因是若之後我們在 Hexo 增加文章留言功能,**預設頁面是可以留言的**,但有時候我們會希望頁面就是專門提供資訊,不開放留言,就可以增加這段語法。 ``` sh title: about date: 2021-08-28 18:46:39 comments: false <!-- 設定為 false 表示不開放留言 --> ``` 接下來的內容,就一樣使用 Markdown 隨你打啦~後續一樣透過指令 `hexo g` 建立頁面就能看到成果了。 > ## 建立文章分類與標籤頁 而 Hexo 本身提供一些能夠**連動網站資訊的頁面**,例如**文章分類**與**標籤頁**,建立的方式就跟建立自訂頁面一樣: ``` sh # 建立標籤頁 hexo new page tags # 建立分類頁 hexo new page categories ``` 不過建立之後,我們必須再做一個動作,以標籤為例,我們開啟頁面後,一樣會看到預設的 title 與 date 資訊,**此時如果要連接 Hexo 資訊,就要加上 `type` 資訊**,並設定為 `tags`,範例如下: ``` sh title: 標籤 date: 2021-08-28 19:15:03 type: tags <!-- 將頁面類型設定為 tags(標籤) --> comments: false <!-- 設定頁面不開放留言 --> ``` 於是,就可以在標籤頁看到所有標籤啦! ![標籤頁](https://i.imgur.com/NW7Zy9z.png) 分類頁也是利用同樣的方式,增加 type 並設定為 `categories` 即可。 > ## 利用主選單連到頁面(以 Next 佈景主題為例) 因為是設定 Next 方面的內容,所以我們要開啟 ./themes/next/_config.yml 檔案並找到以下語法: ``` yml menu: home: / || fa fa-home #about: /about/ || fa fa-user #tags: /tags/ || fa fa-tags #categories: /categories/ || fa fa-th archives: /archives/ || fa fa-archive #schedule: /schedule/ || fa fa-calendar #sitemap: /sitemap.xml || fa fa-sitemap #commonweal: /404/ || fa fa-heartbeat ``` 我們只要把 `#tags`、`#categories` 解除註解即可,另外 Hexo 很貼心,連同 about 也一起加了 XD 一樣,將 `#about` 那一行解除註解即可。不過如果你的關於頁面不是設定成 about(或許可能是你的英文名字),那就改成你設定的名稱即可。 > ## 後記 如此一來網站基本該有的內容都大致上完成了,雖然後續還有像是留言版的功能,不過這部分就先暫緩,畢竟要先上傳到網路上,才會有人留言嘛!(除非你要自言自語我也是沒意見啦 XD) 因此明天,我們就要將 Hexo 上傳到 Github Pages 上啦,屆時你的部落格就能夠呈現在網路上了。頁面建立好後,就等明天來見證這歷史的一刻吧(?)

    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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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