0.2.0 • Published 2 years ago

unplugin-auto-meta v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

unplugin-auto-meta

Automatically generate <meta> or personalized genrate <meta>

This plugin is a Vite Plugin, and you should use in Vite Project. By the way, it support Vue2, Vue3, React... When your project is Vite Project, you can use it to generate <meta> data.

This plugin can automatically generate keywords by descriptions when the keywords attribute is null. But now the feature only support english, i will try it support more languages on next time.

Welcome to contrubute code here.

Usage

Install

I suggest using pnpm to install because it can quickly install npm package and reuse installed package.

pnpm install unplugin-auto-meta

# or 
npm install unplugin-auto-meta

# or
yarn add unplugin-auto-meta

Using

In vite.config.js / vite.config.ts

This is no names, httpEquivs and charset usage, see bellow:

import UnpluginAutoMeta from 'unplugin-auto-meta'

export default defineConfig({
  plugins: [
    vue(),
    UnpluginAutoMeta({
      name: 'vite-vue3',
      description: 'This is an amusing project, show us contents about vue3 and vite.',
      author: 'qinghuan',
    })
  ],
})

This is have names, httpEquivs and charset usage, if you set author(description, keywords) in names that can overflow name, author, description see bellow:

import UnpluginAutoMeta from 'unplugin-auto-meta'

const options = {
  names: [
    { key: 'author', value: 'qinghuan22' },
  ],
  httpEquivs: [
    { key: 'Content-Security-Policy', content: "default-src 'self'; img-src https://*; child-src 'none';" },
  ]
}

export default defineConfig({
  plugins: [
    vue(),
    UnpluginAutoMeta({
      name: 'vite-vue3',
      description: 'This is an amusing project, show us contents about vue3 and vite.',
      author: 'qinghuan',
      ...options
    })
  ],
})
0.2.0

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago