Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hexo-tag-tweetable-quote

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-tag-tweetable-quote - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

51

index.js

@@ -9,18 +9,18 @@ /**

// Strict mode.
'use strict';
"use strict";
// Package modules.
const assign = require('object-assign');
const path = require('path');
const nunjucks = require('nunjucks');
const querystring = require('querystring');
const assign = require("object-assign");
const path = require("path");
const nunjucks = require("nunjucks");
const querystring = require("querystring");
// Configuration
hexo.config.tweetableQuote = assign({
quote_font_color : '#258fb8',
quote_font_size : '1.7em',
link_font_color : '#6e7b8d',
link_font_size : '1.0em',
via_twitter_account : '',
related_twitter_accounts : ''
quote_font_color : "#258fb8",
quote_font_size : "1.7em",
link_font_color : "#6e7b8d",
link_font_size : "1.0em",
via_twitter_account : "",
related_twitter_accounts : ""
}, hexo.config.tweetableQuote);

@@ -30,12 +30,25 @@

hexo.extend.tag.register('tweetableQuote', function(args) {
hexo.extend.tag.register("tweetableQuote", function(args) {
let quote = args[0];
let author = args[1];
let tweetURL = 'https://twitter.com/intent/tweet?'+querystring.stringify({
"text":quote+" - "+author,
"via":hexo.config.tweetableQuote.via_twitter_account,
"related" : hexo.config.tweetableQuote.related_twitter_accounts
});
let hashtags = args[2];
let URLData = {};
URLData.text = quote + " - " + author;
if(hexo.config.tweetableQuote.via_twitter_account){
URLData.via = hexo.config.tweetableQuote.via_twitter_account;
}
if(hexo.config.tweetableQuote.related_twitter_accounts){
URLData.related = hexo.config.tweetableQuote.related_twitter_accounts;
}
if(hashtags){
URLData.hashtags = hashtags;
}
if(this.permalink){
URLData.url = this.permalink;
}
let tweetURL = "https://twitter.com/intent/tweet?"+querystring.stringify(URLData);
const data = {

@@ -48,7 +61,7 @@ "quote": quote,

"link_font_size":hexo.config.tweetableQuote.link_font_size,
"link_font_color":hexo.config.tweetableQuote.link_font_color,
"link_font_color":hexo.config.tweetableQuote.link_font_color
};
return new Promise(function (resolve, reject) {
nunjucks.render('tweetable-quote.njk', data, function (err, res) {
nunjucks.render("tweetable-quote.njk", data, function (err, res) {
if (err) {

@@ -55,0 +68,0 @@ return reject(err);

{
"name": "hexo-tag-tweetable-quote",
"version": "0.0.2",
"version": "1.0.0",
"description": "hexo tag plugin to add tweetable qoutes to posts and pages",

@@ -5,0 +5,0 @@ "main": "index.js",

# hexo-tag-tweetable-quote for [Hexo](https://hexo.io)
Click to Tweet / Tweetable quotes for [Hexo](https://hexo.io)

@@ -8,8 +7,15 @@ [![npm](https://img.shields.io/npm/v/hexo-tag-tweetable-quote.svg)](https://www.npmjs.com/package/hexo-tag-tweetable-quote)

[![Build Status](https://travis-ci.org/iamchathu/hexo-tag-tweetable-quote.svg?branch=master)](https://travis-ci.org/iamchathu/hexo-tag-tweetable-quote)
[![Dependency Status](https://gemnasium.com/badges/github.com/iamchathu/hexo-tag-tweetable-quote.svg)](https://gemnasium.com/github.com/iamchathu/hexo-tag-tweetable-quote)
[![Code Climate](https://codeclimate.com/github/iamchathu/hexo-tag-tweetable-quote/badges/gpa.svg)](https://codeclimate.com/github/iamchathu/hexo-tag-tweetable-quote)
[![bitHound Overall Score](https://www.bithound.io/github/iamchathu/hexo-tag-tweetable-quote/badges/score.svg)](https://www.bithound.io/github/iamchathu/hexo-tag-tweetable-quote)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b638099f4ae54d66ad048f7fddb4326c)](https://www.codacy.com/app/imchathu/hexo-tag-tweetable-quote?utm_source=github.com&utm_medium=referral&utm_content=iamchathu/hexo-tag-tweetable-quote&utm_campaign=badger)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iamchathu/hexo-tag-tweetable-quote/master/LICENSE)
[![Twitter](https://img.shields.io/twitter/url/https/github.com/iamchathu/hexo-tag-tweetable-quote.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=%5Bobject%20Object%5D)
[![Twitter](https://img.shields.io/twitter/url/https/github.com/iamchathu/hexo-tag-tweetable-quote.svg?style=social)](https://twitter.com/intent/tweet?text=Tweetable+Quotes+plugin+for+%40hexojs&url=https%3A%2F%2Fgithub.com%2Fiamchathu%2Fhexo-tag-tweetable-quote)
Click to Tweet / Tweetable quotes for [Hexo](https://hexo.io)
# About
This is a [Hexo](https://hexo.io) tag plugin for including a tweetable quote into your pages/posts. Example of what they can look like is attached below:
This is a [Hexo](https://hexo.io) tag plugin for including a tweetable quote into your pages/posts with link to post. Example of what they can look like is attached below:

@@ -36,8 +42,8 @@ ![](https://raw.githubusercontent.com/iamchathu/hexo-tag-tweetable-quote/master/screens/preview.png)

tweetableQuote:
quote_font_color : '#258fb8'
quote_font_size : '1.7em'
link_font_color : '#6e7b8d'
link_font_size : '1.0em'
via_twitter_account : 'iamchathu'
related_twitter_accounts : 'iamchathu,twitter'
quote_font_color : #258fb8
quote_font_size : 1.7em
link_font_color : #6e7b8d
link_font_size : 1.0em
via_twitter_account : iamchathu
related_twitter_accounts : iamchathu,twitter
```

@@ -55,6 +61,16 @@

```
{% tweetableQuote 'quote' 'author' %}
{% tweetableQuote 'quote' 'author' ['hashtags'] %}
```
- **quote** - Quote. Defaults to ``.
- **author** - author name of quote. Defaults to ``.
- **hashtags** - [**Optional**] Comma separated hastags. Defaults to ``.
**Example:**
```
{% tweetableQuote 'I am a deeply superficial person.' 'Andy Warhol' 'quote,qod' %}
```
# Example in the Wild

@@ -74,2 +90,2 @@

- [ ] Add Post URL to tweet [(Issue : Accessing Post/Page URL inside plugin)](https://github.com/hexojs/hexo/issues/2305)
- [X] Add Post URL to tweet [(Issue : Accessing Post/Page URL inside plugin)](https://github.com/hexojs/hexo/issues/2305)
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc