New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related posts #81
Comments
I currently use this short method def related(page)
all_pages = blog.tags.slice(*page.tags).values.first
return [] if all_pages.blank?
all_pages.delete_if { |p| p == page }
end
related(current_page) It will return articles collection tied with current page by tags. |
Would be a nice feature! |
I haven't played around with this, but one solution could be to calculate the Levenshtein distance between the page content ( The articles with the lowest Levenshtein distance are the related posts. Here are two Ruby-based algorithm implementations: http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#Ruby |
@dconjar Looks interesting. We should definitely make the implementation pluggable though. Maybe allow other extensions to handle the details |
Released an extension http://ngs.io/2014/05/11/middleman-blog-similar/ |
Cool! |
@ngs that extension is awesome. Well done! 😸 |
@ngs Using it myself on a new project. So cool! |
We should provide a method on each blog article that returns "related articles" for that article. We can crib the algorithm for related posts from https://wordpress.org/extend/plugins/yet-another-related-posts-plugin/
The text was updated successfully, but these errors were encountered: