Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
metalsmith-bitly
Advanced tools
A Metalsmith plugin that adds bitly links to the metadata of each file.
This plugin allows you to retrieve bit.ly short links and use them in your templates. For support questions please use stack overflow or the slack channel.
$ npm i metalsmith-bitly
You can use metalsmith-bitly
with the with Metalsmith's Javascript API or CLI. You must also set the siteURL
value on your site's metadata configuration.
accessToken
: your personal bitly access token (required)baseURL
: your production base URL (semi-required, either this or baseURLGlobalMetadataKey
is needed)baseURLGlobalMetadataKey
: the global metaday key of your production base URL (semi-required, either this or baseURL
is needed)brandedShortDomain
: an override for the default domain (optional, defaults to bit.ly
)pathMetadataKey
: an override for the default file path (optional, defaults to path
)accessToken
In order to utilize this plugin you must request an access token at bit.ly's developer site. Please remember to exclude your bitly authorization key if your repository is public. You can use the below example and include your private configuration file in your repository's .gitignore
file.
const bitly = require('metalsmith-bitly');
const configPrivate = require('../configPrivate');
const Metalsmith = require('metalsmith');
return Metalsmith(__dirname)
.use(bitly({
accessToken: configPrivate.bitlyToken,
baseURL: 'http://welchcanavan.com/'
}))
.build(function(err) {
if (err) throw err;
});
baseURL
A semi-required value, you must specify either this or baseURLGlobalMetadataKey
. This is the base URL that will be combined with your file's path to sent to bit.ly.
const bitly = require('metalsmith-bitly');
const configPrivate = require('../configPrivate');
const Metalsmith = require('metalsmith');
return Metalsmith(__dirname)
.use(bitly({
accessToken: configPrivate.bitlyToken,
baseURL: 'http://welchcanavan.com/'
}))
.build(function(err) {
if (err) throw err;
});
baseURLGlobalMetadataKey
A semi-required value, you must specify either this or baseURL
. Use this if you'd like to make sure this plugin stays in sync with a globally used or required metadate value for your site's production base URL.
const bitly = require('metalsmith-bitly');
const configPrivate = require('../configPrivate');
const Metalsmith = require('metalsmith');
return Metalsmith(__dirname)
.metadata({
siteURL: 'http://welchcanavan.com/',
})
.use(bitly({
accessToken: configPrivate.bitlyToken,
baseURLGlobalMetadataKey: siteURL
}))
.build(function(err) {
if (err) throw err;
});
brandedShortDomain
Specify this value if you have set up a Branded Short Domain with bit.ly.
const bitly = require('metalsmith-bitly');
const configPrivate = require('../configPrivate');
const Metalsmith = require('metalsmith');
return Metalsmith(__dirname)
.use(bitly({
accessToken: configPrivate.bitlyToken,
baseURL: 'http://welchcanavan.com/',
brandedShortDomain: 'http://xiw.cx/'
}))
.build(function(err) {
if (err) throw err;
});
pathMetadataKey
To be used in concert with the metalsmith-permalinks plugin. You can specify a file metadata key to match a pattern used in the permalinks plugin. Order is important here, you have to run metalsmith-bitly
after metalsmith-permalinks
or the paths won't match.
---
title: A Post About A Thing
slug: post-thing
---
const bitly = require('metalsmith-bitly');
const collections = require('metalsmith-collections');
const configPrivate = require('../configPrivate');
const Metalsmith = require('metalsmith');
const permalinks = require('metalsmith-permalinks');
return Metalsmith(__dirname)
.use(collections({
posts: {
pattern: 'posts/*.md',
sortBy: 'date',
reverse: true
}
}))
.use(permalinks({
linksets: [
{
match: { collection: 'posts' },
pattern: ':slug'
}
]})
)
.use(bitly({
accessToken: configPrivate.bitlyToken,
pathMetadataKey: 'slug'
}))
.build(function(err) {
if (err) throw err;
});
Note: I've thought about including an option to focus this plugin on a collection or list of collections. If that would be of interest to you, feel free to leave a note or a pull request.
MIT
FAQs
A metalsmith plugin for bitly links
We found that metalsmith-bitly 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.