Skip to content

xiongxianzhu/hexo-theme-xxcoding

Repository files navigation

hexo-theme-xxcoding

打造一款属于自己的hexo主题

GitHub tag (latest Ver) Hexo version support is 5.4.0+ node version npm version license

简体中文 | English

✨ 特征

  • 🌈 响应式布局、 扁平风格、 高大上
  • 基于materialize进行Material Design
  • APlayer音乐播放器
  • DaoVoice在线聊天
  • 数据统计与分析:百度统计、 谷歌分析、 CNZZ、 LeanCloud、 不蒜子网站统计
  • lazyload 图片懒加载
  • 评论系统: disqus、 Valine、 gitalk、 gitment、 livere、 畅言
  • prismjs代码高亮
  • resume 简历
  • gallery 相册
  • portfolio 作品集
  • links 友情链接
  • tagcloud 标签云
  • timeline 时间线
  • TOC 文章目录 tocbot
  • 文章置顶sticky
  • 文章打赏
  • 🌍 国际化支持多语言, 目前支持简体中文English繁体中文
  • 🎨 支持每个细节自定义主题
  • 支持emoji表情
  • live2d-widget看板娘

目录结构

$ tree -L 2
.
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── README_EN.md
├── _config.template.yml
├── _config.yml
├── languages
│   ├── en.yml
│   ├── zh-CN.yml
│   └── zh-TW.yml
├── layout
│   ├── 404.ejs
│   ├── _partial
│   ├── _widget
│   ├── about.ejs
│   ├── archive.ejs
│   ├── category.ejs
│   ├── index.ejs
│   ├── layout.ejs
│   ├── page.ejs
│   ├── post.ejs
│   ├── resume.ejs
│   ├── search.ejs
│   └── tag.ejs
├── scripts
└── source
    ├── css
    ├── fonts
    ├── img
    ├── js
    └── libs

📦 安装

🔨 配置

新建分类 categories 页

hexo new page categories
---
title: categories
date: 2021-04-15 22:46:55
type: categories
layout: categories
---

新建标签 tags 页

hexo new page tags
---
title: tags
date: 2021-04-15 22:53:20
type: tags
layout: tags
---

新建关于我 about 页

hexo new page about
---
title: about
date: 2021-04-15 22:53:27
type: about
layout: about
---

新建留言板 comments 页 (可选)

hexo new page comments
---
title: comments
date: 2021-04-15 22:53:27
type: comments
layout: comments
---

新建友情链接 friends 页 (可选)

hexo new page friends
---
title: friends
date: 2021-04-15 22:53:27
type: friends
layout: friends
---

新建时间线 timeline 页 (可选)

hexo new page timeline
---
title: timeline
date: 2021-04-15 22:53:27
type: timeline
layout: timeline
---

新建简历 resume 页 (可选)

hexo new page resume
---
title: resume
date: 2021-04-15 22:53:27
type: resume
layout: resume
---

新建Vlog vlog 页 (可选)

hexo new page vlog
---
title: vlog
date: 2021-04-15 22:53:27
type: vlog
layout: vlog
---

新建作品集 portfolio 页 (可选)

hexo new page portfolio
---
title: portfolio
date: 2021-04-15 22:53:27
type: portfolio
layout: portfolio
---

新建图库 galleries 页 (可选)

hexo new page galleries
---
title: galleries
date: 2021-04-15 22:53:27
type: galleries
layout: galleries
---

新建音乐库 musics 页 (可选)

hexo new page musics
---
title: musics
date: 2021-04-15 22:53:27
type: musics
layout: musics
---

新建视频库 videos 页 (可选)

hexo new page videos
---
title: videos
date: 2021-04-15 22:53:27
type: videos
layout: videos
---

新建图书库 books 页 (可选)

hexo new page books
---
title: books
date: 2021-04-15 22:53:27
type: books
layout: books
---

自定义css样式

在主题配置文件_config.yml里, 指定你自定义css样式的css文件,如下, 然后在主题下的source/css/my.css里写上你自己自定义的样式吧。

libs:
  css:
    mycss: /css/my.css

如my.css文件内容,可使导航栏背景颜色渐变:

/* 自定义你自己的样式 */

.nav-color {
    /* background: #212121; */
    background: linear-gradient(to right, #EC6C6C, #FFD479, #FFFC79, #73FA79, #73FA79, #73FDFF, #D783FF);
}

.nav-item-color {
    /* color: #fff; */
    color: #0e7477;
}

自定义文章链接

在项目下的_config.yml里找到以下配置:

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

替换为:

permalink: :year/:month/:day/:permalink_id/

评论系统

文章置顶

./node_modules/hexo-generator-index/lib/generator.js文件中, 找到以下代码:

sort(posts.data, (a, b) => (b.sticky || 0) - (a.sticky || 0));

可知, 在文章的Front-matter中添加属性sticky可实现置顶功能, 其中数值越大越靠前。示例:

---
title: mac下安装go开发环境
date: 2021-03-18 11:15:11
tags:
    - go
    - mac
categories: go
permalink_id: install-go-on-mac
sticky: 10
---

插件

主题内置插件

bower install <package>

主题大部分本地插件库通过bower下载, 将插件库的核心文件如dist目录下的*.min.css, *.min.js及字体文件拷贝到本主题下的./source/libs/<package>/下。

hexo项目根目录下执行npm install时, 安装hexo会依赖安装prismjs, 本主题下的prism是自定义的css样式

🎨 自定义代码高亮插件prism的样式

./node_modules/prismjs/themes/prism-tomorrow.css即本主题下的./source/libs/prism/prism-tomorrow-night.css样式

默认使用prism-tomorrow-night.css

配色参考:

博客插件

npm install <package> --save

插件:

  • hexo-deployer-git
  • hexo-generator-feed
  • hexo-generator-sitemap
  • hexo-generator-search
  • hexo-wordcount
  • hexo-filter-github-emojis
  • hexo-generator-feed
  • hexo-baidu-url-submit
  • hexo-permalink-pinyin

data目录

hexo_project/source/_data
  • 图库: gallery.yml
  • 追加head: head.yml
  • 友情链接: links.yml

🤝 贡献

许可证

license

本主题使用了 MIT 许可证进行开源许可。

预览

🔗 链接

灵感