3.0.1 • Published 4 years ago

@netsells/nuxt-meta-builder v3.0.1

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

Nuxt Meta Builder

NPM version Build Status Dependency Status

A fluent approach to building up the meta data object within a Nuxt project

Why?

The standard approach to building up the meta content powered by vue-meta is to manually create an object with keys and values and is often a repeated mess across pages. This approach makes this a bit more readable via fluent methods.

Installation

yarn add @netsells/nuxt-meta-builder

Usage

Add the module to your nuxt config's modules array:

module.exports = {
    ...
    modules: [
        '@netsells/nuxt-meta-builder',
    ],
    ...
};

You can then access the $metaBuilder function on the Vue instance:

<script>
    export default {
        // Basic usage
        head() {
            return this.$metaBuilder()
                .setTitle('My page title')
                .setDescription('The description for the current page')
                .make();
        },       
    };
</script>

Available API Methods

MethodDescriptionArguments
setDescriptionSet both the description and the og:description meta dataval required - the description to set
setTitleSet both the title and the og:title meta datahid - the title to set content optional, default = false - the title value to set
addMetaSet specific meta valueshid required - the unique meta tag id to set. Can be a single string or an array of stringscontent required - the meta value to set
makeGenerate the resulting objectNone.

Note: All public API methods return the class instance and can be chained, other than the make command which returns the final meta object and should be called last.

License

MIT © Netsells

3.0.1

4 years ago

3.0.0

4 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.0

5 years ago