@agirorn/metalsmith-title

0.0.2 • Public • Published

Build Status

@agirorn/metalsmith-title

This is a clone of the original metalsmith-title

A Metalsmith plugin that automatically add page title from first heading in processed file

This clone of metalsmith-title adds an option to remove title after detecting it and setting it as metadata. Useful when you want to use markdown documents verbatim, but have special treatments for titles in your templates, such as putting them inside of tags.

Installation

Using npm

  npm install @agirorn/metalsmith-title

Using yarn

  yarn add @agirorn/metalsmith-title

Usage

Extract the first tile from all (HTML and Markdown) files.

  const title = require('metalsmith-title');
  metalsmith.use(title());

Use the title in a metalsmith-layouts

	<title>{{ title }}</title>

The title can be removed from the file after extraction.

  const title = require('metalsmith-title');
  metalsmith.use(title({ remove: true }));

CLI Usage

Install via npm and then add the metalsmith-title key to your metalsmith.json

  {
    "plugins": {
      "metalsmith-title": true
    }
  }

License

MIT

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @agirorn/metalsmith-title

    Weekly Downloads

    47

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    7.17 kB

    Total Files

    31

    Last publish

    Collaborators

    • agirorn