Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

sergiolepore/hexo-tag-emojis

Repository files navigation

! No longer maintained - Not compatible with Hexo v3+ !

Introduction

This is a hexo tag plugin which allows you to insert emojis on your blog posts.

Plugin installation

Run the following command in the root directory of hexo:

npm install hexo-tag-emojis --save

And enable the plugin in your _config.yml.

plugins:
  - hexo-tag-emojis

Assets configuration

Heads up!

The following methods will define the way that emojis assets will be served to the client. You can only use one method at a time, choose wisely!

Local installation

This plugin comes with all emoji images from emoji-cheat-sheet.com repository. Before using them, you need to deploy the emoji images on your Hexo blog.

First, open your _config.yml file and paste the following lines:

# hexo-tag-emojis plugin configuration
emojis:
  image_dir: images/emojis

Then run this command:

hexo emojis install

To uninstall:

hexo emojis remove

CDN (Content Delivery Network)

You can avoid installing the assets on your blog and use a emoji CDN, like http://cdn.staticfile.org/emojify.js/0.9.5/emojis

Open your _config.yml file and paste the following:

# hexo-tag-emojis plugin configuration
emojis:
  cdn: http://cdn.staticfile.org/emojify.js/0.9.5/emojis

This is particularly useful if you don't want Github to serve your resources. If you choose this method, you don't need to include the image_dir configuration.

Usage

Method 1 - Inline emoji

{% emoji [emojiNameWithoutColons] [emojiSize] [class1,class2,class3] %}

Example:

{% emoji heart 32 custom_class1,custom_class2 %}

Will generate the following HTML:

<img width="32" height="32" class="emoji nofancybox custom_class1 custom_class2" title="heart" src="/images/emojis/heart.png">

Heads up!

  • emojiSize defaults to 20.
  • Classes must be comma-separated and without spaces between them.
  • emoji and nofancybox classes are added automatically.

Method 2 - Emoji block

This is the best choice if you want to process a whole paragraph.

{% emoji_block [emojiSize] [class1,class2,class3] %}
    Lorem ipsum dolor sit amet :emojiName:
    consectetur  adipisicing elit :anotherEmojiName:
{% endemoji_block %}

Example:

{% emoji_block %}
    Lorem ipsum dolor sit amet :smiley:
    consectetur  adipisicing elit :boom:
{% endemoji_block %}