Skip to content

Commit

Permalink
新增:百度分享模块,close #4, #19
Browse files Browse the repository at this point in the history
更新了README.md
  • Loading branch information
xiangming committed Sep 3, 2014
1 parent 5f0615d commit fea0a1a
Show file tree
Hide file tree
Showing 12 changed files with 356 additions and 177 deletions.
203 changes: 94 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,56 @@
针对中国大陆地区对hexo官方主题landscape进行优化,主题还在调整中,欢迎[open issue](https://github.com/xiangming/landscape-plus/issues/new)来提建议,参与讨论。
# Landscape plus

## 网站列表
针对中国大陆地区对hexo官方主题landscape进行优化。

## 所有新特性

+ 根据国情,**去掉Google的库**,改用cloudflare的cdn,打开页面不再卡住了。=> [参与国内cdn的讨论](https://github.com/xiangming/landscape-plus/issues/3)
+ 增加了 **语言包**,所以英语不好的同学,我懂你的。
+ 代码高亮,**采用Monokai**,熟悉SublimeText的朋友一定不陌生。
+ 增加了 **友情链接** widget。(已默认开启,修改方法看下面的[常见问题](#常见问题)。)
+ 不使用header里面的大图,节省带宽,页面加载更快。(大图文件还在,恢复方法看下面的[常见问题](#常见问题)。)
+ 修改了原主题的 **配色** 和部分markdown样式(blockquote/code...)
+ 集成 **多说评论模块** 。(开启方法看下面的[常见问题](#常见问题)。)
+ 集成 **百度分享模块** 。(已默认开启,详情看下面的[常见问题](#常见问题)。)

如果你的网站正在使用**landscape-plus**主题,欢迎你将网站添加到wiki的[网站列表](https://github.com/xiangming/landscape-plus/wiki)。我会不定期将[网站列表](https://github.com/xiangming/landscape-plus/wiki)里面的网站添加到**landscape-plus**的默认友情链接
主题还在调整中,欢迎[open issue](https://github.com/xiangming/landscape-plus/issues/new)来提建议,参与讨论

## 与Landscape不同的地方
## 文档目录

- 根据国情,**去掉Google的库**,改用cloudflare的cdn,打开页面不再卡住了。
- 增加了 **语言包**,所以英语不好的同学,我懂你的。
- 代码高亮,**采用Monokai**,熟悉SublimeText的朋友一定不陌生。
- 增加了 **友情链接** widget,已默认开启,可在landscape-plus/_config.yml中自行配置。
- 不使用header里面的大图,节省带宽,页面加载更快。(大图文件还在,你可以很方便的恢复它。)
- 修改了原主题的 **配色** 和部分markdown样式(blockquote/code...)
- 2014-08-22更新:集成 **多说评论系统** 。(当开启多说评论后,主题将自动忽略disqus,开启方法看下面的Q/A。)
+ [演示](#演示)
+ [安装](#安装)
+ [启用](#启用)
+ [更新](#更新)
+ [配置](#配置)
+ [常见问题](#常见问题)
+ [更新日志](#更新日志)
+ [网站列表](#网站列表)

## 演示

你可以点击[这里](http://reqianduan.com/),查看演示。

## 安装主题
## 安装

``` bash
$ git clone https://github.com/xiangming/landscape-plus.git themes/landscape-plus
```
**Landscape plus 需要 Hexo 2.7 及以上版本.**

## 启用主题
## 启用

修改主题的设置文件`_config.yml`,把`theme`的值设置为`landscape-plus`

## 更新主题
## 更新

``` bash
cd themes/landscape-plus
git pull
```

## Q/A
- **Q**:为什么之前不创建,现在又单独创建了新repo?
- **A**:之前landscape+主题和demo放在一个repo,有的朋友不知道如何使用,所以现在单独创建一个。
- **Q**:Demo看起来很赞,我要**怎么使用landscape+主题?**
- **A**:按照上方的步骤进行安装/启用/更新。
- **Q**:怎么提建议?
- **A**:主题还在调整中,欢迎`open issue`来提建议,参与讨论。
- **Q**:怎么添加友情链接?
- **A**:可在themes/landscape-plus/_config.yml中自行配置。
- **Q**:我喜欢原主题顶部的大图,如何恢复?
- **A**:themes/landscape-plus/source/css/_partial/header.styl,取消第33行的注释。
- **Q**:我是中国人,但是我喜欢英语?
- **A**:这个其实和theme无关,配置你的hexo源文件的_config.yml,删掉`language: zh-CN`
- **Q**:你的字体配色太闪眼睛了,我怎么换回原主题的样式?
- **A**:请参考这条[issue](https://github.com/xiangming/landscape-plus/issues/13)自行配置。
- **Q**:如果开启多说评论系统?
- **A**:修改`landscape-plus\_config.yml`,填写你的多说id即可。(当你设置了多说id,主题将会自动启用多说评论,忽略hexo默认的disqus。)

## TODO
1. 使用国内社交网络,代替Facebook,twitter等?

---

# Landscape+

Landscape+ is modified from the default theme of Hexo 2.4+ for the mainland of China.

- [Preview](http://reqianduan.com/)

## Installation

### Install

``` bash
$ git clone https://github.com/xiangming/landscape-plus.git themes/landscape-plus
```

**Landscape+ requires Hexo 2.4 and above.**

### Enable

Modify `theme` setting in `_config.yml` to `landscape-plus`.

### Update
## 配置

``` bash
cd themes/landscape-plus
git pull
```

## Configuration

``` yml
```yml
# Header
menu:
Home: /
Expand All @@ -96,78 +59,100 @@ rss: /atom.xml

# Content
excerpt_link: Read More
fancybox: true
fancybox: false

# Sidebar
sidebar: right
widgets:
- category
- tag
- tagcloud
- archives
- archive
- recent_posts
- links

# Links
links:
主题作者: http://themes.xiguabaobao.com
iOS开发博客: http://bawn.github.io/
tangyumeng's blog: http://tangyumeng.com/
novsec's blog: http://www.novsec.com/
小峰网络遨游记: http://xfeng.me/
沉默紀: http://silenceage.com/

# Miscellaneous
google_analytics:
favicon: /favicon.png
twitter:
google_plus:
```
fb_admins:
fb_app_id:

- **menu** - Navigation menu
- **rss** - RSS link
- **excerpt_link** - "Read More" link at the bottom of excerpted articles. `false` to hide the link.
- **fancybox** - Enable [Fancybox]
- **sidebar** - Sidebar style. You can choose `left`, `right`, `bottom` or `false`.
- **widgets** - Widgets displaying in sidebar
- **google_analytics** - Google Analytics ID
- **favicon** - Favicon path
- **twitter** - Twiiter ID
- **google_plus** - Google+ ID
# Duoshuo
duoshuo_shortname:

## Features
# Baidu share
baidushare: true
```

### Fancybox
+ `links` - 友情链接
+ `duoshuo_shortname` - 多说评论id
+ `baidushare` - 是否开始百度分享

Landscape+ uses [Fancybox] to showcase your photos. You can use Markdown syntax or fancybox tag plugin to add your photos.
## 常见问题

```
![img caption](img url)
****:Demo看起来很赞,我要**怎么使用landscape+主题?**
> 按照上方的步骤进行`安装``启用``更新`
{% fancybox img_url [img_thumbnail] [img_caption] %}
```
****:怎么提建议?
> 主题还在调整中,欢迎[open issue](https://github.com/xiangming/landscape-plus/issues/new)来提建议,参与讨论。
### Sidebar
****:怎么添加友情链接?
> 修改`themes/landscape-plus/_config.yml`中的`links`
You can put your sidebar in left side, right side or bottom of your site by editing `sidebar` setting.
****:我喜欢原主题顶部的大图,如何恢复?
> `themes/landscape-plus/source/css/_partial/header.styl`,取消第33行的注释。
Landscape+ provides **6** built-in widgets:
****:我是中国人,但是我喜欢英语?
> 配置你的hexo源文件的`_config.yml`,去掉`language: zh-CN`
- category
- tag
- tagcloud
- archives
- recent_posts
- links
****:Landscape plus主题的字体配色太闪眼睛了,我怎么换回原主题的样式?
> 请参考这条[issue](https://github.com/xiangming/landscape-plus/issues/13)进行配置。
All of them are enabled by default. You can edit them in `widget` setting.
****:如何开启多说评论模块?
> 修改`themes/landscape-plus\_config.yml`,填写你的多说id即可。(主题会自动启用多说评论,忽略hexo默认的disqus。)
## Development
****:如何开启百度分享模块?
> 修改`themes/landscape-plus\_config.yml`,将`baidushare`设置为`true`即可。(已默认开启)
### Requirements
## 更新日志

- [Grunt] 0.4+
- Hexo 2.4+
### v1.0.1
+ 新增: 百度分享模块

### Grunt tasks
### v1.0.0
+ 修改:根据国情,去掉Google的库,改用cloudflare的cdn
+ 新增:语言包
+ 修改:代码高亮配色修改为`Monokai`
+ 新增:友情链接
+ 修改:隐藏顶部大图
+ 修改:主题配色和部分markdown样式
+ 新增:多说评论模块

- **default** - Download [Fancybox] and [Font Awesome].
- **fontawesome** - Only download [Font Awesome].
- **fancybox** - Only download [Fancybox].
- **clean** - Clean temporarily files and downloaded files.
## 网站列表

[Hexo]: http://zespia.tw/hexo/
[Fancybox]: http://fancyapps.com/fancybox/
[Font Awesome]: http://fontawesome.io/
[Grunt]: http://gruntjs.com/
+ **[reqianduan]** - Landscape plus主题演示
+ **[bawn]** - iOS开发博客
+ **[tangyumeng]** - tangyumeng's blog
+ **[novsec]** - novsec's blog
+ **[joysboy]** - 小峰网络遨游记
+ **[沉默紀]** - Silenceage

[reqianduan]: http://reqianduan.com/
[bawn]: http://bawn.github.io/
[tangyumeng]: http://www.tangyumeng.com
[novsec]: http://www.novsec.com/
[joysboy]: http://xfeng.me/
[沉默紀]: http://silenceage.com/

如果你的网站正在使用**landscape-plus**主题,欢迎将网址添加到[wiki的网站列表](https://github.com/xiangming/landscape-plus/wiki),我会不定期进行整理。
5 changes: 4 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ fb_admins:
fb_app_id:

# Duoshuo
duoshuo_shortname:
duoshuo_shortname:

# Baidu share
baidushare: true
19 changes: 17 additions & 2 deletions layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if (theme.duoshuo_shortname){ %>
<!-- Duoshuo start -->
<!-- 多说公共js代码 start -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"<%= theme.duoshuo_shortname %>"};
(function() {
Expand All @@ -11,7 +11,7 @@ var duoshuoQuery = {short_name:"<%= theme.duoshuo_shortname %>"};
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<!-- Duoshuo end -->
<!-- 多说公共js代码 end -->
<% } else if (config.disqus_shortname){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
Expand All @@ -28,6 +28,21 @@ var duoshuoQuery = {short_name:"<%= theme.duoshuo_shortname %>"};
</script>
<% } %>

<!-- 百度分享 start -->
<% if (theme.baidushare){ %>
<div id="article-share-box" class="article-share-box">
<div id="bdshare" class="bdsharebuttonbox article-share-links">
<a class="article-share-weibo" data-cmd="tsina" title="分享到新浪微博"></a>
<a class="article-share-weixin" data-cmd="weixin" title="分享到微信"></a>
<a class="article-share-qq" data-cmd="sqq" title="分享到QQ"></a>
<a class="article-share-renren" data-cmd="renren" title="分享到人人网"></a>
<a class="article-share-more" data-cmd="more" title="更多"></a>
</div>
</div>
<script>window._bd_share_config={"common":{},"share":{"bdCustomStyle":"nocss.css"}};with(document)0[(getElementsByTagName("head")[0]||body).appendChild(createElement("script")).src="http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion="+~(-new Date()/36e5)];</script>
<% } %>
<!-- 百度分享 end -->

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<% if (theme.fancybox){ %>
Expand Down
8 changes: 7 additions & 1 deletion layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@
<% } %>
</div>
<footer class="article-footer">
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>" class="article-share-link"><%= __('share') %></a>
<% if (theme.baidushare){ %>
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>" class="article-share-link" data-share="baidu"><%= __('share') %></a>
<% } else { %>
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>" class="article-share-link"><%= __('share') %></a>
<% } %>

<% if (post.comments && theme.duoshuo_shortname){ %>
<a href="<%- post.permalink %>#ds-thread" class="article-comment-link">Comments</a>
<% } else if (post.comments && config.disqus_shortname){ %>
<a href="<%- post.permalink %>#disqus_thread" class="article-comment-link">Comments</a>
<% } %>

<%- partial('post/tag') %>
</footer>
</div>
Expand Down
43 changes: 42 additions & 1 deletion source/css/_partial/article.styl
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,13 @@

$article-share-link
width: 50px
height: 36px
height: 50px
display: block
float: left
position: relative
color: #999
text-shadow: 0 1px #fff
cursor: pointer;
&:before
font-size: 20px
font-family: font-icon
Expand All @@ -271,6 +272,46 @@ $article-share-link
&:hover
color: #fff

.article-share-weibo
@extend $article-share-link
&:before
content: "\f18a"
&:hover
background: color-weibo
text-shadow: 0 1px darken(color-weibo, 20%)

.article-share-weixin
@extend $article-share-link
&:before
content: "\f1d7"
&:hover
background: color-weixin
text-shadow: 0 1px darken(color-weixin, 20%)

.article-share-qq
@extend $article-share-link
&:before
content: "\f1d6"
&:hover
background: color-qq
text-shadow: 0 1px darken(color-qq, 20%)

.article-share-renren
@extend $article-share-link
&:before
content: "\f18b"
&:hover
background: color-renren
text-shadow: 0 1px darken(color-renren, 20%)

.article-share-more
@extend $article-share-link
&:before
content: "\f067"
&:hover
background: color-more
text-shadow: 0 1px darken(color-more, 20%)

.article-share-twitter
@extend $article-share-link
&:before
Expand Down

0 comments on commit fea0a1a

Please sign in to comment.