主题可参考:https://hexo.io/themes/html
hexo默认主题:Landscapegit
示例主题:Nextgithub
进入Blog所在目录,输入下载命令shell
#进入Blog所在目录 d: cd Blog #下载 git clone https://github.com/iissnan/hexo-theme-next themes/next
启用Next主题浏览器
在Blog文件夹下打开配置文件_config.yml,找到theme字段,将默认的landscape修改成next。markdown
# Extensions ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: next
保存。网络
验证hexo
命令行窗口输入:ide
hexo s --debug
浏览器输入:localhost:4000查看界面主题。post
主题配置文件在:/Blog/themes/next/_config.yml
打开主题配置文件,选择next提供的4种子主题,示例启动Mist
# --------------------------------------------------------------- # Scheme Settings # --------------------------------------------------------------- # Schemes #scheme: Muse scheme: Mist #scheme: Pisces #scheme: Gemini
打开主题配置文件,/Blog/themes/next/_config.yml;
找到menu settings
# --------------------------------------------------------------- # Menu Settings # --------------------------------------------------------------- menu: home: / || home about: /about/ || user tags: /tags/ || tags categories: /categories/ || th archives: /archives/ || archive schedule: /schedule/ || calendar sitemap: /sitemap.xml || sitemap # commonweal: /404/ || heartbeat # Enable/Disable menu icons. #icon name(和http://fontawesome.io/icons/ 上面图标name对应) #上方||后面的即为menu_icon名称,不准在下面重复定义 menu_icons: enable: true
关闭注释便可打开博客菜单。
建立菜单文件目录,打开菜单后须要建立菜单文件存放的目录;
一下命令是在命令窗口,Blog目录下执行:D:\Blog>
#标签菜单 hexo new page tags #分类菜单 hexo new page categories #关于菜单 hexo new page about
执行完上面的命令后,会在Blog/source目录下多出tags和categories文件夹,文件夹下的makedown文件即为标签和分类菜单的展现页面内容,下面为标签和分类添加配置。
打开/tags/index.md
--- title: tags date: 2019-05-30 14:07:09 type: "tags" ---
打开/categories/index.md
--- title: categories date: 2019-05-30 14:07:09 type: "categories" ---
保存后,便可在新的文章撰写前添加标签和分类。
标签分类示例:(新建文件参考上一篇start my blog)
--- title: my first blog date: 2019-05-30 14:07:09 tags: - hexo - example categories: - Example --- the blog content.
上面新建文件标签为:hexo
,example
;分类为:Example
.
其余菜单相似。
打开主题配置文件,/Blog/themes/next/_config.yml;
找到sidebar settings
# --------------------------------------------------------------- # Sidebar Settings # --------------------------------------------------------------- # Social Links. #取消注释便可打开社交网络连接 social: GitHub: https://github.com/yourname || github #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 #VK Group: https://vk.com/yourname || vk #StackOverflow: https://stackoverflow.com/yourname || stack-overflow #YouTube: https://youtube.com/yourname || youtube #Instagram: https://instagram.com/yourname || instagram #Skype: skype:yourname?call|chat || skype #上方||后面的即为social_icon名称,不准在下面重复定义 social_icons: enable: true GitHub: github icons_only: false transition: false
头像设置
在Blog/source目录下新建images文件夹,将本身喜欢的头像放在文件夹下,
Blog/source/head.jpg,
在主题配置文件中找到avatar,
# Sidebar Avatar # in theme directory(source/images): /images/avatar.gif # in site directory(source/uploads): /uploads/avatar.gif avatar: /images/head.jpg
做者和简述及语言
打开hexo配置文件,/Blog/_config.yml
# Site title: Tassel #网站标题 description: welcome to my blog. #描述 author: tassel #做者 language: zh-Hans #语言:简体中文
控制在首页文章显示字数,next主题默认显示文章全部内容,能够经过如下配置实现缩略显示,并给出显示更多按钮。
方法一:
在每一篇文章任意位置添加
<!-- more -->
方法二:
在文章的front-matter(即头部添加标签和分类的地方)中添加description,并提供文章摘录。
方法三:
自动造成摘要,在主题配置文件中(/Blog/themes/next/config.yml)修改以下配置
# Automatically Excerpt. Not recommend. # Please use <!-- more --> in the post to control excerpt accurately. auto_excerpt: enable: true length: 150
修改完配置后须要从新生成并部署到github
hexo clean hexo generate hexo deploy
其余更多更高级配置参考next主题官方网站:Next