Socket
Socket
Sign inDemoInstall

vue-html-meta

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-html-meta

Easy setting HTML tags in head (title, meta, jsonld, etc...) for Vue


Version published
Weekly downloads
2
Maintainers
1
Install size
316 kB
Created
Weekly downloads
 

Readme

Source

vue-html-meta

npm version

How it works

<script setup>
import { mountMeta } from 'vue-html-meta'

const { title, meta, jsonld } = mountMeta()

title.value = 'My Page'
meta.value = [
  { name: 'description', content: 'hello' }
]
jsonld.value = {
  '@context': 'https://schema.org'
}
</script>
<head>
  <title>My Page</title>
  <meta name="description" content="hello">
  <script type="application/ld+json">{"@context":"https://schema.org"}</script>
</head>
npm inatll vue-html-meta
# or
yarn add vue-html-meta

API

createMeta

  • createMeta(options?: MetaPluginOptions): MetaPlugin

mountMeta

  • mountMeta(): MetaData | undefined
interface MetaData {
  /*
   * The text of <title>
   */
  title: Ref<string | undefined>

  /*
   * The attributes of <meta> tags
   */
  meta: Ref<MetaProps[] | undefined>

  /*
   * JSON-LD. This value will stringify to JSON and
   * render to <script type="application/ld+json">{...}</script> in <head>
   */
  jsonld: Ref<object | undefined>
}

type MetaProps = {
  [key: string]: string
}

Known Issues

Why not use Transport?

This is intentionally to avoid hydration, checking and errors. Transport to the head tag can fail hydration. This is because HTTP middleware and other libraries can change the head. However there is room to consider the option of using transport.

License

Apache 2.0

Keywords

FAQs

Last updated on 09 Jun 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc