Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@netsells/nuxt-meta-builder

Package Overview
Dependencies
Maintainers
6
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netsells/nuxt-meta-builder

meta builder class so that you can build the meta object up in a more fluent way

  • 3.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
13
Maintainers
6
Weekly downloads
 
Created
Source

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 strings

content [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

Keywords

FAQs

Package last updated on 14 Sep 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc