Skip to content
A Metalsmith plugin for adding metadata for projects (think portfolio content) from GitHub or filesystem (through metalsmith-collections) that can be looped over for creating a portfolio of work.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.gitignore
.travis.yml
LICENSE
README.md
package-lock.json
package.json
shrinkwrap.yaml
tsconfig.json

README.md

metalsmith-projects

Build Status Greenkeeper badge

A Metalsmith plugin for adding metadata for projects (think portfolio content) from GitHub or filesystem (through metalsmith-collections) that can be looped over for creating a portfolio of work.

Installation

$ npm install metalsmith-projects

Usage

There are currently two sources from which projects can be retrieved from:

  • GitHub: retrieves metadata on all public non-fork repositories owned by the provided username, plus any specific additional repositories.
  • collection: retrieves metadata from the front-matter of files under a specified collection.

All sources add objects to the the metadata property projects of the form:

Property Type
name String
owner String
fullName String
description String
stargazerCount Number
lastUpdated Date
languages String[]
url String

Multiple sources can be used simultaneously in the same call to metalsmith-projects.

Source: GitHub

const projects = require("metalsmith-projects").default;

metalsmith.use(projects({
  github: {
    authToken: "<githubOAuth2Token>", // optional (see note below)
    username: "AshleyWright",
    additionalRepos: ["<owner>/<repoName>", ...],  // optional
    exclude: ["<owner>/<repoName>", ...] // optional
  }
}))

Note: although an authToken is not required, absence of one incurs greater GitHub API rate limiting.

Source: collection

const collections = require("metalsmith-collections");
const projects = require("metalsmith-projects").default;

metalsmith.use(collections({
  <collectionName>: "<fileGlob>"
})).use(projects({
  collection: {
    name: "<collectionName>",
    defaultOwner: "<defaultOwner>"
  }
}))

The mapping of file front-matter to project metadata is as follows:

Project metadata Frontmatter Default Value
name projectName or title "Unnamed"
owner owner options.collection.defaultOwner
fullName projectFullName or title "Unnamed"
description projectDescription "" (the empty string)
stargazerCount stargazerCount 0
lastUpdated lastUpdated or datePublished undefined
languages projectLanguages []
url url metadata.site.url + fileMetadata.path

MIT © Ashley Wright

You can’t perform that action at this time.