zoukankan      html  css  js  c++  java
  • Hexo | 给hexo博客添加douban读书页

    1. 原理

    爬取 个人豆瓣网页,嵌入到 个人博客页面

    准备:

    • 注册/登录 豆瓣
    • 搜索书籍,选择 「想读」或 「在读」 或 「读过」,生成读书记录
    • 豆瓣ID , 进入主页,浏览器网址栏的https://www.douban.com/people/xxxxxxxxx/ 的 xxxxxxxxx 就是

    2. 安装配置

    git bash中

    1、安装依赖模块

    npm install hexo-douban --save
    

    2、博客站点根目录下的 _config.yml 文件中添加

    douban:
      user: XXXXXXX
      builtin: false # 选择是否有主题渲染
      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
    

    参数说明:

    参数 说明
    user 你的豆瓣 id
    builtin (true/false)是否将生成页面的功能嵌入hexo s和hexo g中
    title 该页面的标题
    quote 写在页面开头的一段话,支持html语法.
    timeout 爬取数据的超时时间

    ⚠️默认为 false, 如果不设置 为true,则需要添加 hexo douban -bgm命令才能让功能生效(如下启动命令)

    设置为true即是将命令嵌入到hexo shexo g中,这样生成会自动执行hexo douban -bgm

    3、启动生成

    -bgm代表的是book、game、movie三个参数,选择你需要生成的页面。

    hexo clean && hexo douban -bgm && hexo g && hexo s
    

    查看http://localhost:4000/books或者http://localhost:4000/movies测试(出现相应内容即配置成功)。

    另外,修改你的主题配置_config.xml,我这里是butterfly.yml,配置到目录;如果有中英文设置,相应配置即可,不唯一。

    4、部署

    ⚠️强调:由于hexo douban的简写也是hexo d,与hexo deploy的简写指令hexo d冲突,因此在进行二者部署的时候,只能都打全名而不能打简写形式。

    hexo clean && hexo g && hexo deploy
    

    6、如果你是butterfly主题,可以配置封面页哦:

    # 如果你有使用hexo-douban,可配置這個
    douban:
       meta: true
       movies_img: /image/movie.jpg
       books_img: /image/book.jpg
    #   games_img:
    

    参考:

    来源: 博客园
    作者: 茶哩哩
    文章: 转载请注明原文链接:https://www.cnblogs.com/martin-1/p/14808787.html

  • 相关阅读:
    洛谷 P1282 多米诺骨牌
    【2017杭二联考】穿越矩形
    【2017杭二联考】 图的有向环
    树状数组
    Test2014-3-1 魅力值比较
    NOI2007 货币兑换
    POI2001 金矿
    太空飞行计划问题
    Genotype&&陨石的秘密
    usaco 土地并购 && hdu 玩具装箱
  • 原文地址:https://www.cnblogs.com/martin-1/p/14808787.html
Copyright © 2011-2022 走看看