next主题优化

NEXT主题安装

下载next主题

$ cd your-hexo-site`
$ git clone https://github.com/iissnan/hexo-theme-next themes/next

修改站点配置文件

找到hexo中的_config.yml文件

# Extensions
## Plugins: http://hexo.io/plugins/
## Themes: http://hexo.io/themes/
theme: landscape

至此,NexT主题就安装好了,非常方便,在Hexo中切换主题只需修改站点配置文件中theme属性来配置,想换就换。

选择Scheme

next通过scheme提供主题中的主题。

# Schemes
scheme: Mist  #去掉默认的注释即可切换为Mist主题

我的博客使用的为mist主题

菜单设置

next主题的菜单设置,用于设置博客上方导航栏可以在主题配置中进行修改。

menu:
  home: /                       #主页
  categories: /categories	#分类页(需手动创建)
  #about: /about		#关于页面(需手动创建)
  archives: /archives		#归档页
  tags: /tags			#标签页(需手动创建)
  #commonweal: /404.html        #公益 404 (需手动创建)

但要注意只在menu选项中设置不能让标签页生效,这些页面需要我们手动创建。

标签页面

运行hexo new page "tags"可在/source目录下生成一个tags文件,里面包含有index.md文件这时把上方的tags注释掉,在平时建的博客中加入tags就会形成分类,在标签页可以看到。

分类页面

与标签页面同理,但要创建的是categories。

侧边头像设置

在主题配置文件中找到_config.yml,搜索avatar字段,增加avatar: /images/avatar.png可以使用本地字段但要注意图片名称。

设置头像边框为圆形

打开位于themes/next/source/css/_common/components/sidebar/sidebar-author.syl文件修改为

.site-author-image {
  display: block;
  margin: 0 auto;
  padding: $site-author-image-padding;
  max-width: $site-author-image-width;
  height: $site-author-image-height;
  border: $site-author-image-border-width solid $site-author-image-border-color;
 // 修改头像边框
  border-radius: 50%;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
}

特效:鼠标放置头像上旋转

.site-author-image {
  display: block;
  margin: 0 auto;
  padding: $site-author-image-padding;
  max-width: $site-author-image-width;
  height: $site-author-image-height;
  border: $site-author-image-border-width solid $site-author-image-border-color;
 // 修改头像边框
  border-radius: 50%;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  // 设置旋转
  transition: 1.4s all;
}
// 可旋转的圆形头像,`hover`动作
.site-author-image:hover {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -transform: rotate(360deg);
}

侧边栏设置

设置侧边栏社交连接

打开_config.yml文件搜索social,添加社交站点名称与地址即可。

# ---------------------------------------------------------------
# Sidebar Settings
# ---------------------------------------------------------------

# Social Links.
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimeter is the target permalink.
# Value after `||` delimeter is the name of FontAwesome icon. If icon (with or without delimeter) is not specified, globe icon will be loaded.
social:
  E-Mail: mailto:yourname@gmail.com || envelope
  Google: https://plus.google.com/yourname || google
  Twitter: https://twitter.com/yourname || twitter
  FB Page: https://www.facebook.com/yourname || facebook
  # 等等

设置侧边栏社交图标

在_config.yml中搜索social_icons,添加社交站点名称(注意大小写)图标,可以全网图标下载找图标地,非常方便。

友情链接

打开_config.yml搜索Blog rolls

# Blog rolls
links_title: 友情链接 #标题
links_layout: block #布局,一行一个连接
#links_layout: inline
links: #连接
  baidu: http://example.com/
  google: http://example.com/

代码块自定义样式

// Custom styles.
code {
    color: #ff7600;
    background: #fbf7f8;
    margin: 2px;
}
// 边框的自定义样式
.highlight, pre {
    margin: 5px 0;
    padding: 5px;
    border-radius: 3px;
}
.highlight, code, pre {
    border: 1px solid #d6d6d6;
}

在右上或左上实现fork me on github

选择样式github-ribbons注意修改<a href="https://github.com/you">将这里换为你自己的GitHub主页。打开themes/next/layout/_layout.swig文件,把代码复制到<div class="headband"></div>下面。

文章顶部显示更新时间

打开_config.yml,搜索update_at设置为true:

# Post meta display settings
post_meta:
  item_text: true
  created_at: true
  updated_at: ture
  categories: true

有空续更。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值