Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
hexo-related-popular-posts
Advanced tools
A hexo plugin that generates a list of links to related posts and popular posts.
A hexo plugin that generates a list of links to related posts and popular posts.
A hexo plugin that generates a list of links to related posts based on tags , and plugin that generates a list of links to popular posts base on page view of Google Analytics. Popular posts is need Google Analytics API.
$ npm install hexo-related-popular-posts --save
Add the following helper tag in template file for article.
<%-
popular_posts()
%>
option | description | default |
---|---|---|
maxCount | Maximum count of a list | 5 |
ulClass | Class name of element | 'popular-posts' |
PPMixingRate | Mixing ratio of popular posts and related posts | 0.0 (=Related posts only) |
isDate | visible the date | false |
isImage | visible the image | false |
isExcerpt | visible the excerpt | false |
<%-
popular_posts_json({ maxCount: 5 , ulClass: 'popular-posts' , PPMixingRate: 0.0 , isImage: true})
%>
<%-
popular_posts_json({ maxCount: 10 , ulClass: 'popular-posts' , PPMixingRate: 1.0 })
%>
popular_posts_json
helper.<%-
htmlGenerator(
popular_posts_json({ maxCount: 5 , ulClass: 'popular-posts' , PPMixingRate: 0.0 , isDate: true , isImage: true , isExcerpt: true})
)
%>
If you use popular_posts_json
helper , please add the following helper in template.
// Examples of helper
hexo.extend.helper.register('htmlGenerator', function(args){
if(!args || !args.json || args.json.length == 0)return "";
var returnHTML = "";
function generateHTML(list){
var ret = "";
ret += "<li class=\"" + args.class + "-item\">";
if(list.date && list.date != ""){
ret += '<div class="'+args.class+'-date">' + list.date + "</div>";
}
if(list.img && list.img != ""){
ret += '<div class="'+args.class+'-img">' + '<img src="'+list.img+'" />' + "</div>";
}
ret += '<div class="'+args.class+'-title"><h3><a href="' + list.path + '" title="'+ list.title +'" rel="bookmark">'+ list.title + "</a></h3></div>";
if(list.excerpt && list.excerpt != ""){
ret += '<div class="'+args.class+'-excerpt"><p>' + list.excerpt + "</p></div>";
}
ret += "</li>";
return ret;
}
for(var i=0; i<args.json.length; i++){
returnHTML += generateHTML(args.json[i]);
}
if(returnHTML != "")returnHTML = "<ul class=\"" + args.class + "\">" + returnHTML + "</ul>";
return returnHTML;
});
Popular posts base on page view of Google Analytics. Popular posts is need Google Analytics API. Please edit your config file _config.yml
and set the following options.
Please see https://www.npmjs.com/package/ga-analytics
popularPosts:
googleAnalyticsAPI:
clientId: ******.apps.googleusercontent.com
serviceEmail: *****@developer.gserviceaccount.com
key: /hexo-project-root/path/to/google-services.pem
viewId: 12345678
dateRange: 60
cache:
path: hexo-related-popular-posts-ga-cached.json
expiresDate: 10
If you want to use the environment variable. Please set the following.
$ export GOOGLEAPI_CLIENTID="******.apps.googleusercontent.com"
$ export GOOGLEAPI_EMAIL="*****@developer.gserviceaccount.com"
$ export GOOGLEAPI_KEY="/path/to/google-services.pem"
$ export GOOGLEAPI_ANALYTICS_TABLE="ga:12345678"
MIT
FAQs
A hexo plugin that generates a list of links to related posts and popular posts. Also , this plugin can get Visitor Counts (PageView) on posts.
The npm package hexo-related-popular-posts receives a total of 610 weekly downloads. As such, hexo-related-popular-posts popularity was classified as not popular.
We found that hexo-related-popular-posts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.