avatar

目录
Hexo的安装和配置

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Installation

bash
1
2
3
4
5
6
7
# Install node.js (https://nodejs.org/en/download/)
# Because npm is too slow in China, we use cnpm(http://npm.taobao.org/) for installation
npm install -g cnpm --registry=https://registry.npm.taobao.org
# Install hexo
cnpm install -g hexo-cli
# View version information
hexo -v

Create a new post

bash
1
hexo new "My New Post"

More info: Writing

Generate static files

bash
1
2
3
hexo generate
# or
hexo g

More info: Generating

Run server

bash
1
2
3
4
# Since hexo-server is a seperated plugin now, so we need to install hexo-server manually
npm install --save hexo-server
# Then start the server
hexo server

More info: Server

Deploy to remote sites

bash
1
hexo deploy

Add pin-top support

bash
1
2
3
# replace `hexo-generator-index` with `hexo-generator-index-pin-top`
npm uninstall hexo-generator-index
npm install hexo-generator-index-pin-top --save

Then add top attribute to the article you want to pin-top, e.g.,

markdown
1
2
3
4
5
6
7
---
title: xxxxxx
date: xxxx
tags: xxx
categories: xxx
top: 100
---

The larger the value of top is, the top the article is.

Add music player meting support

When you use MetingJS, your blog can play musics from Tencent, Netease, Xiami, Kugou, Baidu and more. More details here.

If you want to use MetingJS in hexo-tag-aplayer, you need to enable it in _config.yml:

yml
1
2
aplayer:
meting: true

Now you can use meting in your post:

markdown
1
2
3
4
5

{% meting "60198" "netease" "playlist" %}


{% meting "60198" "netease" "playlist" "autoplay" "mutex:false" "listmaxheight:340px" "preload:none" "theme:#ad7a86"%}

The options are shown below:

Option Default Description
id required song id / playlist id / album id / search keyword
server required Music platform: netease, tencent, kugou, xiami, baidu
type required song, playlist, album, search, artist
fixed false Enable fixed mode
mini false Enable mini mode
loop all Player loop play, values: ‘all’, ‘one’, ‘none’
order list Player play order, values: ‘list’, ‘random’
volume 0.7 Default volume, notice that player will remember user setting, default volume will not work after user set volume themselves
lrctype 0 Lyric type
listfolded false Indicate whether list should folded at first
autoplay false Autoplay song(s), not supported by mobile browsers
mutex true Pause other players when this player playing
listmaxheight 340px Max height of play list
preload auto The way to load music, can be none, metadata, auto
storagename metingjs LocalStorage key that store player setting
theme #ad7a86 Theme color

More info: Deployment

文章作者: Reborn
文章链接: https://reborn8888.github.io/2019/12/07/Hexo%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AE/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Reborn
打赏
  • 微信
    微信
  • 支付寶
    支付寶

评论