Skip to content

💿 A simple plugin for hexo that helps us generate pages for douban books ,movies and games.

License

Notifications You must be signed in to change notification settings

oexs/hexo-douban

 
 

Repository files navigation

hexo-douban

一个在 Hexo 页面中嵌入豆瓣个人主页的小插件.

npm Build Status Coverage Status NPM version npm Codacy Badge GitHub license

NPM

安装

$ npm install hexo-douban --save

设置

将下面的配置写入站点的配置文件 _config.yml 里(不是主题的配置文件).

douban:
  user: mythsman
  book:
    title: 'This is my book title'
    quote: 'This is my book quote'
  movie:
    title: 'This is my movie title'
    quote: 'This is my movie quote'
  game:
    title: 'This is my game title'
    quote: 'This is my game quote'
  timeout: 10000 #optional
  • user: 你的豆瓣ID.打开豆瓣,登入账户,然后在右上角点击 "个人主页" ,这时候地址栏的URL大概是这样:"https://www.douban.com/people/xxxxxx/" ,其中的"xxxxxx"就是你的个人ID了。
  • title: 该页面的标题.
  • quote: 写在页面开头的一段话,支持html语法.
  • timeout: 爬取数据的超时时间,默认是 10000ms ,如果在使用时发现报了超时的错(ETIMEOUT)可以把这个数据设置的大一点。

如果只想显示某一个页面(比如movie),那就把其他的配置项注释掉即可。

升级

我会不定期更新一些功能或者修改一些Bug,所以如果想使用最新的特性,可以用下面的方法来更新:

$ npm update hexo-douban --save

显示

如果上面的配置都没问题,就可以在生成站点之后打开 //yourblog/books//yourblog/movies, //yourblog/games, 来查看结果.

菜单

如果上面的显示没有问题就可以在主题的配置文件 _config.yml 里添加如下配置来为这些页面添加菜单链接.

menu:
  Home: /
  Archives: /archives
  Books: /books     #This is your books page
  Movies: /movies   #This is your movies page
  Games: /games   #This is your games page

更新记录

0.2.16

  • 修复了IE/Edge中读书页面图片无法显示的问题

0.2.15

  • 修复了在网站在子目录下时某些资源链接不对的问题

0.2.14

  • 修复了firefox下反防盗链失败的问题.......

0.2.13

  • 修复了断网情况下报错导致无法继续生成页面的bug

0.2.12

  • 添加图片懒加载的特性,减少首次加载时间
  • 添加no-referrer的属性,反防盗链:)

0.2.11

0.2.10

  • 修复了页面在firefox浏览器打开时弹出about:blank的bug

0.2.9

  • 紧急修复了由于豆瓣对前端代码做了简单重构导致的插件爬取电影信息异常的bug

0.2.8

  • 为标签添加国际化设置,支持zh-Hans,zh-tw,en等
  • 考虑到某些剧比较长,存在"在看"这个状态,因此为movie页添加"在看"标签

0.2.7

  • 修复页面显示不正常的bug

0.2.6

  • 添加分页效果
  • 重构模板代码

0.2.5

  • 修复无法适配某些主题的bug

截图

我们在下面这些常见的主题里测试了插件的使用效果:

hexo-theme-landscape

landscape

hexo-theme-next

next

hexo-theme-yilia

yilia

hexo-theme-indigo

indigo

hexo-theme-aath

aath

在线Demo

books

movies

games

FeedBack

如果大家在使用的过程中有什么问题或者意见,欢迎随时提issue。

Lisense

MIT

About

💿 A simple plugin for hexo that helps us generate pages for douban books ,movies and games.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 66.5%
  • HTML 30.3%
  • CSS 3.2%