Skip to content

hellatan/metalsmith-page-titles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metalsmith Page Titles

Build Status

Gives your Metalsmith build the ability to add a global site title to the page title based on your markdown frontmatter and Metalsmith metadata

Installation

npm install --save-dev metalsmith-page-titles

Usage

In your markdown Frontmatter:

---
title: My Specific Page Title
---

JavaScript API:

var Metalsmith = require('metalsmith');
var pageTitles = require('metalsmith-page-titles');

Metalsmith
    .metadata({
        site: {
            title: "My Main Site Title"
        }
    })
    .use(pageTitles())

In your template:

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

Will result in <title>My Specific Page Title | My Main Site Title</title>

options

separator

String - A string to separate the page title from the site metadata title, defaults to ' | '

namespace

String - The key or nested keys to search for based off of the metadata object, defaults to 'site.title'

ns

See namespace

prepend

Boolean - Prepend the site metadata title? Defaults to false

Notes

The metalsmith cli workflow has not been tested

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published