Hexo結合Github建立靜態部落格

2021-07-16 05:31:00 字數 3246 閱讀 7782

首先初始化檔案目錄

$ hexo init

安裝所需檔案

$ npm install

執行檔案

$ hexo server瀏覽器輸入localhost:4000,你就可以在本地檢視到新建的專案。

建立新的文章

$ hexo new "文章題目"進入路徑 專案\source_posts\中手動編譯文章頁面,使用markdown模式。

部署到github上

在配置檔案中(專案_config.yml)修改資料

# deployment

## docs:

deploy:

type: github

repository: [email protected]:你的賬戶名/你的賬戶名.github.io.git

branch: master

或者

# deployment

## docs:

deploy:

type: git

repository: 你的賬戶名/你的賬戶名.github.com.git

branch: master

然後執行命令

hexo clean清除舊的內容

hexo g或者hexo generate生成新的內容

hexo d或者hexo deploy部署上傳

檢視成果

等一分鐘,你就可以通過http://你的賬戶名.github.io/來訪問你新建立的靜態部落格了。

# hexo configuration

## docs:

## source: tommy351/hexo/

# site 這裡的配置,哪項配置反映在**,可以參考我的部落格

title: zippera's blog #站點名,站點左上角

subtitle: walk steps step by step #副標題,站點左上角

description: walk steps step by step #給搜尋引擎看的,對站點的描述,可以自定義

author: zippera #在站點左下角可以看到

email: #你的聯絡郵箱

language: zh-cn #中文顯示

# url #這項暫不配置,繫結網域名稱後,欲建立sitemap.xml需要配置該項

## if your site is put in a subdirectory, set url as '' and root as '/child/'

url:

root: /

permalink: :year/:month/:day/:title/

tag_dir: tags

archive_dir: archives

category_dir: categories

# writing 文章布局、寫作格式的定義,不修改

new_post_name: :title.md # file name of new posts

default_layout: post

auto_spacing: false # add spaces between asian characters and western characters

titlecase: false # transform title into titlecase

max_open_file: 100

filename_case: 0

highlight:

enable: true

backtick_code_block: true

line_number: true

tab_replace:

# category & tag

default_category: uncategorized

category_map:

tag_map:

# archives 預設值為2,這裡都修改為1,相應頁面就只會列出標題,而非全文

## 2: enable pagination

## 1: disable pagination

## 0: fully disable

archive: 1

category: 1

tag: 1

# server 不修改

## hexo uses connect as a server

## you can customize the logger format as defined in

## port: 4000

logger: false

logger_format:

# date / time format 日期格式,不修改

## hexo uses moment.js to parse and display date

## you can customize the date format as defined in

## date_format: mmm d yyyy

time_format: h:mm:ss

# pagination 每頁顯示文章數

## set per_page to 0 to disable pagination

per_page: 10

pagination_dir: page

duoshuo_shortname:

#主題## plugins:

## themes:

theme: light

exclude_generator:

plugins:

- hexo-generator-feed

- hexo-generator-sitemap

# deployment 站點部署到github要配置,上一節中已經講過

## docs:

deploy:

type: github

repository: 你的使用者名稱/你的使用者名稱.github.io.git

branch: master

假如你想要在不同的電腦上寫部落格,除了都要安裝環境外,你可以把專案提交到github上的另外乙個倉庫,或者該倉庫的另外乙個分支,每次換電腦都同步一下,非常的方便簡單。

github上HEXO部落格的建立

hexo是乙個靜態部落格框架,能夠很方便的在github上搭起來個人部落格。首先要安裝node.js npm install hexo g 全域性安裝hexo 在當前目錄下初始化乙個部落格資料夾myblog hexo init myblog 進入部落格目錄 cd myblog 安裝package.j...

用HEXO在Github建立個人部落格

npm install g hexo cli hexo init zhaoolee blog cd zhaoolee blog npm install hexo new 在github建立個人專屬名片 在sublime開啟新建的 zhaoolee blog source posts 在github建...

Hexo 搭建github個人部落格

主要有一下幾個指令 hexo new n 寫文章 hexo generate g 把文章生成頁面 hexo server s 啟動本地服務除錯 hexo deploy d 部署到github 可與hexo g合併為 hexo d g 如果喜歡以官方教程為主的,點這裡 hexo官方文件 因此以下教程是...