From 3f29aa74091b3f12b251a0784b52ce3605b25a95 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 15 Aug 2018 23:48:38 +0800 Subject: [PATCH] update --- README.md | 223 +++++++++++++++++++++++++--------- _config.yml | 103 +++++++++------- layout/_partial/archive.ejs | 9 +- layout/_partial/article.ejs | 4 +- layout/_partial/footer.ejs | 20 ++- layout/_partial/header.ejs | 54 ++++---- layout/_partial/scripts.ejs | 20 +-- layout/_partial/side.ejs | 4 +- layout/_widget/categories.ejs | 2 +- layout/_widget/contacts.ejs | 22 ++-- layout/_widget/links.ejs | 32 +++-- layout/_widget/music.ejs | 4 +- source/less/_widget.less | 2 +- 13 files changed, 308 insertions(+), 191 deletions(-) diff --git a/README.md b/README.md index 352a3a6..625a697 100755 --- a/README.md +++ b/README.md @@ -49,59 +49,133 @@ npm i -S hexo-generator-search hexo-generator-feed hexo-renderer-less hexo-autop -## 博客配置项 +## 主题配置 -这一部分属于博客配置,要修改的文件是博客主目录的`_config.yml`文件。 +把 `themes/material-x/_config.yml` 中的 `materialx:` 相关的内容复制到博客主目录的 `_config.yml` 文件中,根据自己的需要填写和修改。 +这样做的好处是:更新主题的时候你修改过的配置就不会被覆盖了。 +以下这些配置如果没有特殊说明,都指的是博客主目录的 `_config.yml` 文件。 -### 头像 -如果你没有设置头像,将会显示默认头像,如果你不想显示任何头像,请修改主题的配置项。 + +### 导航栏 + +你可以 `materialx:` 下面找到类似这一段,把它改为你需要的: ```yaml -avatar: "https://xaoxuu.com/assets/img/avatar.jpg" +materialx: + # 导航栏 + nav_menu: + - name: 主页 + slug: about + fa: home + url: / + - name: 项目 + slug: projects + fa: cube + url: https://xaoxuu.com/proj + - name: 博客 + slug: home + fa: rss + url: / + - name: 归档 + slug: archives + fa: archive + url: /archives ``` -### 评论 -提供3种可选,如果你使用其他的评论系统,请自己修改主题。 +其中 `fa` 是 `font-awesome` 图标名,你要显示什么图标,去 [font-awesome](https://fontawesome.com/icons?d=gallery) 找就可以了。 -#### Disqus -官网: [http://disqus.com/](http://disqus.com/) + +### 侧边栏 + +右边的小窗口,可以根据需要显示。 + +#### 头像 + +如果你没有设置头像,将会显示默认头像。 ```yaml -# disqus评论 -disqus_shortname: #你的disqus的shortname# +avatar: "https://xaoxuu.com/assets/img/avatar.jpg" # 如果没有设置头像 url 将会显示默认头像。 + +# 主题配置 +materialx: + widgets: + - avatar # 把这一项注释掉就不显示头像了 ``` -#### Livere 来必力 -官网: [http://www.laibili.com.cn/](http://www.laibili.com.cn/) +#### 分类 ```yaml -# 来必力评论 -livere_shortname: #你的disqus的shortname# +# 主题配置 +materialx: + widgets: + - categories # 把这一项注释掉就不显示了 ``` -#### Valine -官网: [https://valine.js.org](https://valine.js.org) + + +#### 标签 ```yaml -# valine -valine: - enable: true # 如果你想用Valine评论系统,请设置enable为true - appId: - appKey: - guest_info: nick,mail #valine comment header info - placeholder: 快来评论吧~ # valine comment input placeholder(like: Please leave your footprints ) - avatar: mp # gravatar style https://valine.js.org/avatar - pageSize: 10 # comment list page size - verify: false # valine verify code (true/false) - notify: false # valine mail notify (true/false) - lang: zh-cn +# 主题配置 +materialx: + widgets: + - tagcloud # 把这一项注释掉就不显示了 +``` + + + +#### 网易云音乐歌单 + +```yaml +# 主题配置 +materialx: + widgets: + - music # 把这一项注释掉就不显示了 + # 网易云音乐歌单id + widgets_musicid: 746319661 +``` + + + +#### 联系信息 + +```yaml +# 主题配置 +materialx: + widgets: + - contacts # 把这一项注释掉就不显示了 + # 右边的联系信息小窗口 + widgets_contacts: + - name: GitHub + desc: xaoxuu + url: https://github.com/xaoxuu + - name: 10086 + desc: 测试打电话 + url: tel:10086 +``` + + + +#### 友链 + +```yaml +# 主题配置 +materialx: + widgets: + - links # 把这一项注释掉就不显示了 + # 侧边栏的友链 + widgets_links: + - name: xaoxuu + url: https://xaoxuu.com ``` + + ### 推荐文章 如果你不想显示推荐文章,可以卸载 `hexo-recommended-posts` 这个依赖包。 @@ -123,55 +197,74 @@ recommended_posts: -## 主题配置项 +### 评论 -`themes/material-x/_config.yml` 这个才是主题的配置项,别搞错了哦。 +提供3种可选,如果你使用其他的评论系统,请自己修改主题。 +#### Disqus +官网: [http://disqus.com/](http://disqus.com/) -### 导航栏 +```yaml +# disqus评论 +disqus_shortname: #你的disqus的shortname# +``` -你可以找到类似这一段,把它改为你需要的: +#### Livere 来必力 + +官网: [http://www.laibili.com.cn/](http://www.laibili.com.cn/) ```yaml -menu: -- name: 主页 - slug: about - fa: home - url: https://xaoxuu.com -- name: 项目 - slug: projects - fa: cube - url: https://xaoxuu.com/proj -- name: 博客 - slug: home - fa: rss - url: / -- name: 归档 - slug: archives - fa: archive - url: /archives +# 来必力评论 +livere_shortname: #你的disqus的shortname# ``` +#### Valine -其中 `fa` 是 `font-awesome` 图标名,你要显示什么图标,去 [font-awesome](https://fontawesome.com/icons?d=gallery) 找就可以了。 +官网: [https://valine.js.org](https://valine.js.org) +```yaml +# valine +valine: + enable: true # 如果你想用Valine评论系统,请设置enable为true + appId: # 必填 + appKey: # 必填 + guest_info: nick,mail #valine comment header info + placeholder: 快来评论吧~ # valine comment input placeholder(like: Please leave your footprints ) + avatar: mp # gravatar style https://valine.js.org/avatar + pageSize: 10 # comment list page size + verify: false # valine verify code (true/false) + notify: false # valine mail notify (true/false) + lang: zh-cn +``` -### 自定样式 -打开 `themes/material-x/source/less/_defines.less` 这个文件,修改下面这些内容为你需要的即可: +### 页脚 ```yaml -// 主题色 -@primary-color: @xiaowenwen-green; -// 强调色 -@accent-color: @material-orange; -// ... +# 主题配置 +materialx: + # 页脚 + footer_social: + - slug: envelope + url: mailto:me@xaoxuu.com + - slug: github + url: https://github.com/xaoxuu + - slug: instagram + url: + - slug: google-plus + url: + - slug: twitter + url: + - slug: music + url: ``` -## 文章配置项 + + +## 单篇文章的配置 某一篇文章不想开启评论 @@ -191,6 +284,18 @@ recommended_posts: false +## 主题色和其他样式 + +打开 `themes/material-x/source/less/_defines.less` 这个文件,修改下面这些内容为你需要的即可: + +```yaml +// 主题色 +@primary-color: @xiaowenwen-green; +// 强调色 +@accent-color: @material-orange; +// ... +``` + 其他的暂时不想写了,自己摸索吧~ diff --git a/_config.yml b/_config.yml index 3fa8f27..81507fc 100755 --- a/_config.yml +++ b/_config.yml @@ -1,55 +1,66 @@ # 导航栏 +materialx: + # 导航栏 + nav_menu: + - name: 主页 + slug: about + fa: home + url: / + - name: 项目 + slug: projects + fa: cube + url: https://xaoxuu.com/proj + - name: 博客 + slug: home + fa: rss + url: / + - name: 归档 + slug: archives + fa: archive + url: /archives + # 右边的小窗口 + widgets: + - avatar # 显示个人头像,如果注释掉这一行就不显示 + - categories # 显示分类 + - tagcloud # 显示tags + - contacts # 显示自己的联系信息 + - music # 显示自己的网易云歌单 + - links # 显示友链 + # 网易云音乐歌单id + widgets_musicid: + # 侧边栏的友链 + widgets_links: + - name: xaoxuu + url: https://xaoxuu.com + # 右边的联系信息小窗口 + widgets_contacts: + - name: GitHub + desc: xaoxuu + url: https://github.com/xaoxuu + - name: 10086 + desc: 测试打电话 + url: tel:10086 + # 页脚 + footer_social: + - slug: envelope + url: mailto:me@xaoxuu.com + - slug: github + url: https://github.com/xaoxuu + - slug: instagram + url: + - slug: google-plus + url: + - slug: twitter + url: + - slug: music + url: -menu: -- name: 主页 - slug: about - fa: home - url: https://xaoxuu.com -- name: 项目 - slug: projects - fa: cube - url: https://xaoxuu.com/proj -- name: 博客 - slug: home - fa: rss - url: / -- name: 归档 - slug: archives - fa: archive - url: /archives -# 右边的小窗口 -widgets: - - avatar # 显示个人头像,如果注释掉这一行就不显示 - - categories # 显示分类 - - tagcloud # 显示tags - - contacts # 显示自己的联系信息 - - music # 显示自己的网易云歌单 - - links # 显示友链 -# 页面底部的社交信息 -social: -- slug: envelope - url: mailto:me@xaoxuu.com -- slug: github - url: https://github.com/xaoxuu -- slug: instagram - url: https://www.instagram.com/xaoxuu -- slug: google-plus - url: -- slug: twitter - url: https://twitter.com/xaoxuu -- slug: music - url: https://music.163.com/#/user/home?id=63035382 - - -# 推荐文章 npm install hexo-recommended-posts --save -recommended_posts: - enabled: true # Search -search: +nav_search: enable: true service: hexo # google @@ -66,8 +77,6 @@ search: # baidu baidu_api_id: - - # Less less: compress: true diff --git a/layout/_partial/archive.ejs b/layout/_partial/archive.ejs index fdf0d19..313871b 100755 --- a/layout/_partial/archive.ejs +++ b/layout/_partial/archive.ejs @@ -13,9 +13,16 @@ <% } %>
+ <% if(!config.materialx){ %> +
+
+ +
+
+ <% } %> <% page.posts.each(function(post){ %>
- <%- partial('post', {post: post}) %> + <%- partial('post', {post: post}) %>
<% }) %>
diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs index ff1aea7..1c9a8b8 100755 --- a/layout/_partial/article.ejs +++ b/layout/_partial/article.ejs @@ -61,11 +61,11 @@
-<% if (post && ((theme.recommended_posts.enabled && post.recommended_posts != false) || post.comments )) { %> +<% if (post && ((config.recommended_posts.autoDisplay == false && post.recommended_posts != false) || post.comments )) { %>
- <% if (post && theme.recommended_posts.enabled && post.recommended_posts != false) { %> + <% if (post && config.recommended_posts.autoDisplay == false && post.recommended_posts != false) { %> <%- partial('post/recommended_posts', {page: post, site: site}) %> <% } %> diff --git a/layout/_partial/footer.ejs b/layout/_partial/footer.ejs index 593737b..967d326 100755 --- a/layout/_partial/footer.ejs +++ b/layout/_partial/footer.ejs @@ -1,20 +1,16 @@