Socket
Socket
Sign inDemoInstall

hexo-featured-image

Package Overview
Dependencies
127
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.2.0

24

index.js

@@ -20,13 +20,19 @@ var fs = require('hexo-fs');

var thumbnail = yaml.loadFront(data.raw).thumbnail;
var imagePrefix = imagesPath;
// Use post asset folder
if (post_asset_folder) {
data.featured_image = data.permalink + featured_image;
if(thumbnail){
data.thumbnail = data.permalink + thumbnail;
}
} else {
data.featured_image = imagesPath + featured_image;
if(thumbnail){
data.thumbnail = imagesPath + thumbnail;
}
imagePrefix = data.permalink;
}
// Check if the featured image path is an absolute URI
if (featured_image.indexOf('http') === 0 || featured_image.indexOf('/') === 0) {
// Use no prefix since we have the full or relative URI
imagePrefix = '';
}
// Compile the featured image URI
data.featured_image = imagePrefix + featured_image;
if (thumbnail) {
data.thumbnail = imagePrefix + thumbnail;
}
}

@@ -33,0 +39,0 @@ return data;

@@ -12,3 +12,3 @@ {

],
"version": "0.1.1",
"version": "0.2.0",
"main": "index",

@@ -15,0 +15,0 @@ "license": "MIT",

@@ -51,3 +51,3 @@ # Hexo Featured Image

### post_asset_folder
This plugin works without configuration if you are using [post asset folders](https://hexo.io/docs/asset-folders.html), or you are storing your images in `source/images`.
This plugin works without configuration if you are using absolute or relative URI's, [post asset folders](https://hexo.io/docs/asset-folders.html), or you are storing your images in `source/images`.

@@ -54,0 +54,0 @@ If you are not using post asset folders, and you prefer to store your images somewhere else than in `source/images`, you must specify `image_dir` in `_config.yml` to wherever you store your images. To set your image directory to `source/assets`, you would set `image_dir: assets` in `_config.yml`. Example:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc