• Stars
    star
    495
  • Rank 88,355 (Top 2 %)
  • Language
    CSS
  • Created over 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A responsible theme for Hexo

Huno

Huno是为Hexo编写的一个响应式的主题,该主题基于Uno

Demo

Huno's demo

安装

$ git clone git://github.com/someus/huno.git themes/huno

修改Hexo的配置文件_config.xml

theme: huno

兼容性

在Hexo 3.1.1测试正常。

配置示例

# Header
menu:
  首页: /#blog
  关于: /about
  归档: /archive

# Site favicon
favicon: /favicon.png

# Site logo
# logo: /avatar.png

# Enable Mathjax
mathjax: true

# Enable awesome-toc
awesome_toc: true

# Enable githubRepoWidget
github_repo_widget: false

menu中定义/#blog是必须的,示例中的/about/archive是两个页面。/archive会在下面的归档页面中介绍。

mathjax:

数学公式支持。其设置(layout/_scripts/mathjax.ejs)如下:

$(document).ready(function(){
    MathJax.Hub.Config({ 
        tex2jax: {inlineMath: [['[latex]','[/latex]'], ['\\(','\\)']]} 
    });
});

官网:mathjax

awesome_toc:

为文章生成目录。

官网:awesome-toc

github_repo_widget:

可视化显示github中的项目。

官网:GitHub-jQuery-Repo-Widget

侧边栏图片

侧边栏图片URL定义在source/css/uno.css中下面的这段代码中:

.panel-cover {
  display: block;
  position: fixed;
  z-index: 900;
  width: 100%;
  max-width: none;
  height: 100%;
  background: url(../images/background-cover.jpg) top left no-repeat #666666;
  background-size: cover; }

可以看出图片路径是source/images/background-cover.jpg。可以根据需要替换成不同的图片,或者修改图片URL。例如修改成CDN中的某个图片(#28):

background: url("//img.alicdn.com/tps/TB1UC8nJVXXXXbRXpXXXXXXXXXX-1920-1200.jpg") top left no-repeat #666666;

归档页面

归档页面会显示分类、标签云以及基于日期的归档。

在主题的配置文件_config.yml中:

# Header
menu:
  首页: /#blog
  关于: /about
  归档: /archive

创建新的page:

$ hexo new page archive
$ cd source/archive
$ vim index.md

内容修改为:

title: 归档
layout: page-archive
---

浏览器访问http://127.0.0.1:4000/archive/即可。

!! hexo 默认有一个/archives,如果您认为归档页面的url(/archive)和这个冲突,可以选更加合适的名称😊

评论系统

将评论系统(例如Disqus、多说、友言、畅言等)提供的代码片段粘贴在layout/_partials/comments.js中即可。

Social Icon

默认提供了Github的图标,Github用户名请在Hexo的配置文件_config.yml中配置,例如:

# Social
social:
  github: someus

可以根据需要在layout/_partials/social.ejs中添加更多的图标。

China Social Icon

这套字体来自 设计素材:国内常用社交图标的web字体, 版权归原作者所有。在huno中CSS文件做了些修改。

这套字体和上面Social Icon的设计得并不一样,如果混用,排版效果会略差。例如,在layout/_partials/social.ejs加上:

<li class="navigation__item">
  <a href="" title="">
    <i class='icon cs-icon-douban'></i>
    <span class="label">Douban</span>
  </a>
</li>

<li class="navigation__item">
  <a href="" title="">
    <i class='icon cs-icon-weibo'></i>
    <span class="label">Weibo</span>
  </a>
</li>

效果如下:

字体文件位于source/fonts/china-social/中,对应的css文件是source/css/china-social-icon.css

网站统计

将网站统计(如Google analysis、CNZZ、百度统计等)代码放入layout/_scripts/site-analytics.ejs即可。

如何将Huno生成的静态网站放在某网站子目录

例如要将其放入http://hi.letiantian.xyz/huno/下,则需要:

修改Hexo配置文件_config.yml:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://hi.letiantian.xyz/huno
root: /huno/

修改主题的配置文件_config.yml:

# Header
menu:
  首页: /huno/#blog
  关于: /huno/about
  归档: /huno/archive

# Site favicon
favicon: /huno/favicon.png

修改huno/source/js/main.js:

if (window.location.pathname != "/") {
  $('.panel-cover').addClass('panel-cover--collapsed');
}

修改为

if (window.location.pathname != "/huno/") {
  $('.panel-cover').addClass('panel-cover--collapsed');
}

修改huno/layout/_partials/side-panel.ejs:

<% for (var i in theme.menu){ %>
  <%
    if (theme.menu[i]+'' == '/#blog') {
      nav_btn_class = 'blog-button';
    } else {
      nav_btn_class = '';
    }
  %>

修改为:

<% for (var i in theme.menu){ %>
  <%
    if (theme.menu[i]+'' == '/huno/#blog') {
      nav_btn_class = 'blog-button';
    } else {
      nav_btn_class = '';
    }
  %>

其他

如果在中国大陆使用该主题后,访问速度变慢,可以考虑注释掉source/css/uno.css的第一行。

License

Creative Commons Attribution 4.0 International

More Repositories

1

TextRank4ZH

🌳从中文文本中自动提取关键词和摘要
Python
3,067
star
2

Pinyin2Hanzi

拼音转汉字, 拼音输入法引擎, pin yin -> 拼音
Python
552
star
3

another-tutorial-about-java-web

😿 another tutorial about java web
340
star
4

tencent-open-source

腾讯开源作品整理
Python
274
star
5

how-to-load-dynamic-script

The right way to load javascript files dynamically.
HTML
217
star
6

ChineseTone

[本项目不再维护] 将汉字转换为拼音, 支持多音字,拼音 -> pin yin
Hack
204
star
7

kmedoids

[Unmaintained] The Python implementation of k-medoids.
Python
119
star
8

flask-tutorial

Python Flask Web 框架入门教程
50
star
9

awesome-toc

generate awesome toc for web page
HTML
44
star
10

jianshu-site-search

简书站内搜索
Python
24
star
11

mybatis-tutorial

mybatis 入门教程
Java
16
star
12

Flask-dashboard-for-UPYUN

基于Python Flask框架的又拍云管理工具
JavaScript
16
star
13

paste-as-markdown

Paste HTML as Markdown
JavaScript
5
star
14

TPP

[Deprecated] A PHP framework
PHP
3
star
15

mini-pinyin

Get tone(pinyin) of Chinese character.
JavaScript
2
star
16

n-source

源码注释 https://github.com/tj/n
Shell
2
star
17

rq-source

源码注释 https://github.com/nvie/rq
Python
2
star
18

random-password-cli

Generate random password in cli.
JavaScript
2
star
19

center-text

Center the output in terminal.
Shell
1
star
20

terminal-text-width

Get the number of columns occupied by specified text in terminal.
JavaScript
1
star
21

pocha-demos

pocha is python's mocha.
Python
1
star
22

lyric-player

Play lyric in terminal.
JavaScript
1
star
23

p

PS1 management
Python
1
star
24

Timestamp-Workflow

Alfred Workflow 时间戳转换
Python
1
star
25

wxapp-find-pinyin

微信小程序:查拼音
JavaScript
1
star