Giter Site home page Giter Site logo

fossabot / hexo-near-post Goto Github PK

View Code? Open in Web Editor NEW

This project forked from achauvinhameau/hexo-near-post

0.0 2.0 0.0 25 KB

module for hexo.io for publishing a "see also" section on post based on distance between posts

License: GNU General Public License v3.0

Makefile 10.10% Python 59.49% JavaScript 30.40%

hexo-near-post's Introduction

Build Status FOSSA Status

Purpose

hexo-near-post is a tool that proposes article to be read near the one currently consulted. 2 steps in the process, computing of the proximity of all the posts and widget to display the nearest.

Install

sudo pip install --upgrade -r requirements.txt

Calculating distance

The python script (no time to build a node one yet) hexo-nearest-compute.py is comparing all the posts one to one in order to calculate a distance. Distance is based on number of same words in both posts including description, tags, category, title.

This needs to be run each time a post is created or modified, no link yet with the hexo generate process

typical usage:

python hexo-nearest-compute.py --path ~/blog/source/

Arguments:

  • --path: hexo source directory (where _posts will be found)
  • -f: force rebuild of the database
  • --database: link to the near-post.json file (should be at base of your hexo site)

hexo plugin

installation from your hexo site directory:

npm install hexo-near-post --save

in the _config.yml file, add the following section and configure it as you prefer:

near_post:
  enabled: true
  limit: 2
  posts: 3
  heading: see also
  • enabled could be turned false if you simply want to disable all the near post section in your articles
  • limit: minimum affinity between post
  • posts: number of post to link with if available
  • heading: name of the section (h2 tag used)

you can tweek your css for the near_post section:

#near_posts {
  h2 {
    font-size: 1.4em;
    margin-bottom: 0px;
  }

  ul {
    margin-left: 20px;
  }

 .distance {
     font-size: 0.75rem;
     color: darkgrey;
  }
}

finaly on each post you want the near_post section to be added, insert a specific tag:

@@@near_posts@@@

you can add it by default in the scaffolds/post.md file

License

FOSSA Status

hexo-near-post's People

Contributors

achauvinhameau avatar fossabot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.