
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
contentful-metalsmith
Advanced tools
A Metalsmith' plugin to generate files using content from Contentful
This plugin for metalsmith allows you to build a static site using the data stored at Contentful. It is built on top of the Contentful JavaScript Client.
To get an idea on how this works, you can check out an example blog site which is completely generated using contentful-metalsmith.
$ npm install contentful-metalsmith
When you use metalsmith using the cli edit your metalsmith.json
and add contentful-metalsmith
in the plugins section.
// metalsmith.json
{
"source": "src",
"destination": "build",
"plugins": {
"contentful-metalsmith": {
"access_token": "YOUR_CONTENTFUL_ACCESS_TOKEN",
"space_id": "YOUR_CONTENTFUL_SPACE_ID"
}
}
}
When you use the JavaScript Api add contentful-metalsmith
to the used plugins.
metalsmith.source('src')
metalsmith.destination('build')
metalsmith.use(require('contentful-metalsmith')({ 'access_token' : 'YOUR_CONTENTFUL_ACCESS_TOKEN' }))
Global parameters:
access_token
space_id
You can find the access_token
and space_id
in your app at APIs -> Content delivery API Keys
.
To read more on all global parameters and settings read the global settings documentation.
We're considering that you use metalsmith-layouts for file rendering. That for the layout
key is used for rendered source files and child templates.
source/posts.html
---
title: metalsmith-contentful file
contentful:
content_type: post
entry_filename_pattern: blog/post-${ sys.id }
entry_template: post.html
layout: posts.html
---
[OPTIONAL CONTENT]
layouts/posts.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{title}}</title>
<meta name="description" content="No description">
<meta name="author" content="Contentful">
<link rel="stylesheet" href="scss/style.css?v=1.0">
</head>
<body>
<ul>
<!-- available data fetched from contentful -->
{{#each data.entries }}
<li>
<h2>{{fields.title}}</h2>
<p>{{fields.description}}</p>
<p><a href="{{_fileName}}">Read more</a></p>
</li>
{{/each}}
</ul>
{{contents}}
</body>
</html>
layouts/post.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{data.fields.title}}</title>
<meta name="description" content="No description">
<meta name="author" content="Contentful">
<link rel="stylesheet" href="scss/style.css?v=1.0">
</head>
<body>
<h1>{{data.fields.title}}<h1>
<p>{{data.fields.description}}</p>
{{contents}}
</body>
</html>
This example will
posts.html
providing data of the entries of content type post
post.html
providing the data of a particular postTo read more on source file parameters and settings read the source file documentation.
MIT
FAQs
A Metalsmith's plugin to get content from Contentful
The npm package contentful-metalsmith receives a total of 27 weekly downloads. As such, contentful-metalsmith popularity was classified as not popular.
We found that contentful-metalsmith demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.