1.4.17 ā€¢ Published 1 year ago

nuxt-unhead v1.4.17

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ā„¹ļø Looking for a complete SEO solution? Check out Nuxt SEO Kit.

Features

Unlock all Unhead features and more:

  • šŸ–„ļø 0kb runtime tags useServerHead
  • āœØ Automatic social share meta tags
  • šŸ¤– Debug head tags component DebugHead
  • šŸŒ³ Fully typed Head Schema with href and src file auto-completion
  • šŸ§© Title template tokens: Use public runtime config in your templates: %s %titleSeperator %siteName.
  • šŸŖ Runtime hooks: head:tags, head:entries
  • šŸ“¦ Load your asset files directly using aliases href: '~/assets/style.css' (Experimental)

Background

This module was built to test bug fixes as well as experimental new features which may land into the Nuxt core.

Install

npm install --save-dev nuxt-unhead

# Using yarn
yarn add --dev nuxt-unhead

Setup

nuxt.config.ts

export default defineNuxtConfig({
  modules: [
    'nuxt-unhead',
  ],
})

Module Configuration

Config key: unhead

nuxt.config.ts

export default defineNuxtConfig({
  modules: ['nuxt-unhead'],

  unhead: {
    // config (see below)
  },
  //...
})

Usage

Template Params

When defining your titleTemplate, title or meta content as strings, you can use tokens to reference values from your resolved runtime config.

For example, the default title template introduced by this module is %s %titleSeparator %siteName.

This uses the following:

  • %s - The title of the page.
  • %titleSeparator - runtimeConfig.public.titleSeparator
  • %siteName - runtimeConfig.public.siteName

To provide the values for these tokens, you can update them in your nuxt config.

nuxt.config.ts

export default defineNuxtConfig({
  runtimeConfig: {
    public: {
      siteName: 'My cool site',
      titleSeparator: '|',
    }
  },
})

You can read more about this feature on the docs: Unhead Template Params.

Config

seoOptimise

  • Type: boolean
  • Default: true

    Automatically optimise meta tags for SEO.

    It will automatically infer the og:title, og:description when a title and description are set respectively. It will ensure a twitter:card is set to summary_large_image if not set.

    This will do more in the future.

resolveAliases - EXPERIMENTAL

  • Type: boolean
  • Default: false

    Resolve aliases in href and src attributes. This will allow you to load your asset files directly using aliases.

    <script lang="ts" setup>
    useHead({
      link: [
        {
          rel: 'stylesheet',
          href: '~/assets/style.css',
        },
      ]
    })
    </script>

Components

DebugHead

A component to debug your head tags.

<template>
  <DebugHead />
</template>

Sponsors

License

MIT License Ā© 2022-PRESENT Harlan Wilton

1.4.20

1 year ago

1.4.17

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.4.6

2 years ago

1.4.3

2 years ago

1.3.4

2 years ago

1.4.2

2 years ago

1.3.3

2 years ago

1.4.1

2 years ago

1.3.2

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.4.11

2 years ago

1.4.8

2 years ago

1.4.13

2 years ago

1.4.12

2 years ago

1.4.15

2 years ago

1.4.14

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago