Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
metalsmith-perma
Advanced tools
metalsmith-perma
is an alternative to metalsmith-permalinks
for applying permalinks to your static content.
With npm:
npm install metalsmith-perma
With yarn:
yarn add metalsmith-perma
var metalsmith = require('metalsmith');
var permalinks = require('metalsmith-perma');
metalsmith(__dirname)
.use(permalinks({
pattern: ':title'
}));
metalsmith-perma uses slugify for converting patterns to permalinks. You can pass options to slugify with an options
parameter:
metalsmith.use(permalinks({
pattern: ':title'.
options: {
replacement: '-', // replace spaces with replacement
remove: null, // regex to remove characters
lower: true // result in lower case
}
}));
Slugify options
defaults to { lower: true, remove: /!$'"*+,;=?%/ }
, but you can view a full list of options.
Dates are formatted using date-fns/format.
metalsmith.use(permalinks({
pattern: ':date/:title',
date: 'YYYY'
}));
Permalinks can be defined in the metalsmith pipeline, or in frontmatter.
---
title: Page Title
permalink: custom-path/to/:title
---
Permalinks can be skipped in individual files by including permalink: false
.
---
title: Page Title
permalink: false
---
metalsmith-perma allows you to have multiple sets of matching patterns against matching metadata. Works well with metalsmith-collections
metalsmith
.use(collections({
collections({
posts: {
pattern: 'posts/*.md'
}
})
})
.use(permalinks({
match: { collections: ['post'] },
pattern: 'posts/:title'
}));
Along with pattern matching, you can create different matching patterns of permalinks by including multiple sets of options along with a default
flag to mark the default match.
metalsmith.use(permalinks([
{
match: { collections: ['post'] },
pattern: 'posts/:title'
},
{
match: { collections: ['authors'] },
pattern: 'authors/:name'
},
{
default: true,
pattern: ':title'
}
]));
FAQs
Altenative to metalsmith-permalinks for metalsmith
We found that metalsmith-perma 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.