jekyll-tfidf-related-posts 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/jekyll-tfidf-related-posts.gemspec +1 -1
- data/lib/jekyll-tfidf-related-posts.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3cfeeebb0a49a4e45daf9005cf81a424ff876d0
|
4
|
+
data.tar.gz: 174cc25e49c5da1c2dc4a711f7946c16d749af47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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].
|
37
|
+
doc[:post].data['related_posts'] = related[doc].map { |x| x[:post] }
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|