# hexo-url-image

> a hexo plugin let you can define image url in post md and refer it in templates

Latest version **0.1.0** (published 2016-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install hexo-url-image
pnpm add hexo-url-image
yarn add hexo-url-image
bun add hexo-url-image
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-05-23 |
| First published | 2016-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | roybein |
| Maintainers | roybein |
| Keywords | hexo, url, image |

## Links

- npm: https://www.npmjs.com/package/hexo-url-image
- Repository: https://github.com/roybein/hexo-url-image
- Homepage: https://github.com/roybein/hexo-url-image#readme
- Issues: https://github.com/roybein/hexo-url-image/issues
- npm.io page: https://npm.io/package/hexo-url-image

## Dependencies (2)

- [hexo-fs](https://npm.io/package/hexo-fs.md) ^0.1.5
- [yaml-front-matter](https://npm.io/package/yaml-front-matter.md) ^3.4.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-05-23

## README

# Hexo Url Image

A Hexo plugin to allow adding url_image in front-matter, then you can refer post.url_image in your templates;

For example:

`CoolPost.md`

	---
	title: Cool post
	url_image: my_img.png
	---
	What a cool blog I have!

By setting url_image, you specify a post's url image in its front matter.

The absolute path to `my_img.png` will be available through `post.url_image` in your templates.

For example:

`article.ejs`

	...
	<% if (post.url_image){ %>
        <img src="<%- post.url_image %>">
    <% } %>
    ...

## Installation
	npm install --save hexo-url-image
## Usage
This plugin will make automatically make `post.url_image` available in your templates when you run `hexo server` or `hexo generate`.

If you are using [hexo-generator-json-content](https://github.com/alexbruno/hexo-generator-json-content), it will automatically add the `url_image` property to `content.json` when you run `hexo generate` and when you __exit__ `hexo server`.
## Configuration
### URL
For this plugin to work correctly, you must set `image_server_url` to your URL in `_config.yml`. if you use a image cloud server with url //some.bkt.clouddn.com/,  set it like this:

`_config.yml`

    ...
    # URL
    image_server_url: http://some.bkt.clouddn.com/
    ...

### [hexo-generator-json-content](https://github.com/alexbruno/hexo-generator-json-content) (!!!Experiment)
This plugin plays nicely with [hexo-generator-json-content](https://github.com/alexbruno/hexo-generator-json-content), and will output the absolute path of `url_image` to `content.json` if `url_image` has been set to `true` in the `jsonContent` configuration part of `_config.yml` like so:

	...
    jsonContent: {
    	...
        posts: {
        	...
            url_image: true
            thumbnail: true # if you want thumbnail to be added as well
        }
    }

---
_Source: https://npm.io/package/hexo-url-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
