jekyll-tfidf-related-posts 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd087070d4af03099faba23173e6378bac52c094
4
- data.tar.gz: 8072d1d3c1a33c0ccba6ef4a1ae1aceac07c8c54
3
+ metadata.gz: d3cfeeebb0a49a4e45daf9005cf81a424ff876d0
4
+ data.tar.gz: 174cc25e49c5da1c2dc4a711f7946c16d749af47
5
5
  SHA512:
6
- metadata.gz: c74fdf39ec0a0982ec9915d2614ab316d0a8a269ff4e6c519f229c6f5308fbc00108176efe55312b6f216b9f47bf1680f5e4a5e5a73524be08770e16bb5aa2b7
7
- data.tar.gz: 1c678cd89f1d59151c6706aa4dd3f983b8c5795376a26726d2e722ca2efd7630e693324ca5f3fa311020fc2132f8ecc0a6a1490cd436ecf7675e3c94ce47e9f2
6
+ metadata.gz: 4ed73df8285c8705371d9bae38997b00884632d4627bed20183ef7d26a971ccf851441ee2367aa7828f43b72c807ff42eda2d2d3f22036698b0576c7fbfde5f1
7
+ data.tar.gz: 3d7113697a27a30e3ce662fab0b65385f66386d431ca718b4f757546ad2207bb5cd3d8fa03f32ba1a40b961ba142c486c929460ecedb7ba66c5111703fb3ed2c
data/README.md CHANGED
@@ -4,6 +4,29 @@
4
4
 
5
5
  [Jekyll](http://jekyllrb.com) plugin to show related posts based on the content, tags, and categories. The similarity is calculated using TF-IDF(term frequency-inverted document frequency). Since tags and categories are use-defined values, those are considered with higher weights than a content while calculating.
6
6
 
7
+ ### How to install
8
+
9
+ 1. Install the gem `jekyll-tdidf-related-posts`.
10
+ ```
11
+ $ gem install jekyll-tdidf-related-posts
12
+ ```
13
+ 2. Add `jekyll-tdidf-related-posts` plugin in `_config.xml`.
14
+ ```yaml
15
+ plugins:
16
+ - jekyll-tdidf-related-posts
17
+ ```
18
+ 3. Run `jekyll build` or `jekyll serve`
19
+
20
+
21
+ ### How to use
22
+ This plugin calculates related posts and replaces `site.related_posts` containing recent 10 posts by default. So, you can render related posts by iterating `site.related_posts`.
23
+
24
+ ```
25
+ {% for post in site.related_posts %}
26
+ {% include related-post.html %}
27
+ {% endfor %}
28
+ ```
29
+
7
30
  ### Configuration
8
31
 
9
32
  By default, there are 4 related posts. You can configure it in the `_config.yml`
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "jekyll-tfidf-related-posts"
7
- spec.version = "0.1.1"
7
+ spec.version = "0.1.2"
8
8
  spec.authors = ["Sangsoo Nam"]
9
9
  spec.email = ["sangsoo.ted@gmail.com"]
10
10
  spec.summary = %q{Jekyll plugin to show related posts based on the content, tags, and categories.}
@@ -34,7 +34,7 @@ module Jekyll
34
34
  related = build_related_docs_with_score(site.config['related_posts_count'] || 4)
35
35
 
36
36
  @docs.each do |doc|
37
- doc[:post].instance_variable_set(:@related_posts,related[doc].map { |x| x[:post] })
37
+ doc[:post].data['related_posts'] = related[doc].map { |x| x[:post] }
38
38
  end
39
39
  end
40
40
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-tfidf-related-posts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sangsoo Nam