@rabee-org/svelte-head
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

svelte-head

npm version

svelte-head is a component library that allows you to easily set meta information etc. to be output to head.

Demo

Install

npm install svelte-head --save

Usage

<script>
  import {setOptions, Meta} from 'svelte-head';

  // setup default value
  setOptions({
    title(title) {
      return title ? `${title} | Svelte Head Demo` : 'Svelte Head Demo';
    },
    description(description) {
      return description || `svelte-head is a component library that allows you to easily set meta information etc. to be output to head.`;
    },
    keywords(keywords) {
      return keywords || `svelte,sveltekit,seo,head,meta`;
    },
    ogp(ogp) {
      return {
        type: 'website',
      };
    },
    twitter(twitter) {
      return {
        card: 'summary_large_image',
      };
    },
  });
</script>

<Meta title='Example Title' />

result

<title>Example Title | Svelte Head Demo</title>
<meta name="description" content="svelte-head is a component library that allows you to easily set meta information etc. to be output to head.">
<meta name="keywords" content="svelte,sveltekit,seo,head,meta">
<meta property="og:title" content="Example Title | Svelte Head Demo">
<meta property="og:description" content="svelte-head is a component library that allows you to easily set meta information etc. to be output to head.">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">

License

MIT

Package Sidebar

Install

npm i @rabee-org/svelte-head

Weekly Downloads

17

Version

0.1.0

License

MIT

Unpacked Size

10.4 kB

Total Files

12

Last publish

Collaborators

  • horietty
  • tata_jp
  • ooharamasaki
  • suico
  • juth5
  • mtnn_rabee
  • simiraaaa
  • phi