All Projects → troxler → Vue Headful

troxler / Vue Headful

Licence: mit
Set document title and meta tags with Vue.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Headful

Meta Tags
Search Engine Optimization (SEO) for Ruby on Rails applications.
Stars: ✭ 2,464 (+975.98%)
Mutual labels:  seo, meta-tags
Ultimate Metatags
A large snippet for your page's <head> that includes all the meta tags you'll need for OPTIMAL sharing and SEO. Extensive work has been put into ensuring you have the optimal images for the most important social media platforms.
Stars: ✭ 24 (-89.52%)
Mutual labels:  sharing, meta-tags
meta-tag-gen
Generate HTML code optimal for social media, SEO, mobile. Uses web standards from Open Graph (Facebook) and Twitter to provide optimal results. Also generates social media posts.
Stars: ✭ 24 (-89.52%)
Mutual labels:  seo, meta-tags
Laravelmetatags
The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project
Stars: ✭ 226 (-1.31%)
Mutual labels:  seo, meta-tags
Magento 2 Seo
Magento 2 SEO extension will do perfectly for your better SEO. This is a bundle of outstanding features that are auto-active when you install it from Mageplaza without any code modifications. It is also friendly with your store if you need to insert meta keywords and meta descriptions for your product.
Stars: ✭ 99 (-56.77%)
Mutual labels:  seo, meta-tags
Awesome-meta-tags
📙 Awesome collection of meta tags
Stars: ✭ 18 (-92.14%)
Mutual labels:  seo, meta-tags
Ngx Meta
Dynamic page title & meta tags utility for Angular (w/server-side rendering)
Stars: ✭ 331 (+44.54%)
Mutual labels:  seo, meta-tags
svelte-seo
Optimize your website for search engines and social media with meta tags, Open Graph, and JSON-LD.
Stars: ✭ 257 (+12.23%)
Mutual labels:  seo, meta-tags
Laravel Seo Tools
Laravel Seo package for Content writer/admin/web master who do not know programming but want to edit/update SEO tags from dashboard
Stars: ✭ 99 (-56.77%)
Mutual labels:  seo, meta-tags
Angular Metatags
Module for providing dynamic Meta Tags to Angular routes
Stars: ✭ 62 (-72.93%)
Mutual labels:  seo, meta-tags
laravel-assets
Laravel Assets manager
Stars: ✭ 13 (-94.32%)
Mutual labels:  seo, meta-tags
Ngmeta
Dynamic meta tags in your AngularJS single page application
Stars: ✭ 152 (-33.62%)
Mutual labels:  seo, meta-tags
Head
A simple guide to HTML <head> elements
Stars: ✭ 28,892 (+12516.59%)
Mutual labels:  seo, meta-tags
Fusebox Angular Universal Starter
Angular Universal seed project featuring Server-Side Rendering, @fuse-box bundling, material, firebase, Jest, Nightmare, and more
Stars: ✭ 132 (-42.36%)
Mutual labels:  seo, meta-tags
Seotools
SEO Tools for Laravel
Stars: ✭ 2,406 (+950.66%)
Mutual labels:  seo, meta-tags
Ezshare
Easily share files, folders and clipboard over LAN - Like Google Drive but without internet
Stars: ✭ 182 (-20.52%)
Mutual labels:  sharing
Next Blog
基于react(ssr)服务端框架next.js和antd-design搭建的个人博客
Stars: ✭ 214 (-6.55%)
Mutual labels:  seo
Lighthouse Check Action
GitHub Action for running @GoogleChromeLabs Lighthouse audits with all the bells and whistles 🔔 Multiple audits, Slack notifications, and more!
Stars: ✭ 175 (-23.58%)
Mutual labels:  seo
React Pwa
An upgradable boilerplate for Progressive web applications (PWA) with server side rendering, build with SEO in mind and achieving max page speed and optimized user experience.
Stars: ✭ 2,433 (+962.45%)
Mutual labels:  seo
Sharemeow
😻 text shots service
Stars: ✭ 180 (-21.4%)
Mutual labels:  sharing

vue-headful

vue-headful allows to set the title and several meta tags of your document from any Vue.js view. vue-headful is a tiny wrapper around Headful, a generic library to set meta tags with JavaScript.

Install

npm i vue-headful

Usage

Register the component:

import Vue from 'vue';
import vueHeadful from 'vue-headful';

Vue.component('vue-headful', vueHeadful);

new Vue({
    // your configuration
});

And then use the vue-headful component in every of your views:

<template>
    <div>
        <vue-headful
            title="Title from vue-headful"
            description="Description from vue-headful"
        />
    </div>
</template>

Documentation

vue-headful is only a wrapper around Headful and by itself does not do that much. vue-headful supports all the head properties that are supported by Headful. You can find a non-complete list of head properties in the following example:

<vue-headful
    title=""
    description=""
    keywords=""
    image=""
    lang=""
    ogLocale=""
    url=""
/>

If there are any other head properties or attributes you want to set, you can use html (for arbitrary elements in the whole document) or head (for elements within <head>) as follows. The selectors can be any valid CSS selector.

<vue-headful
    :html="{
        body: {id: 'aPageId'},
        h1: {'data-foo': 'bar'},
    }"
    :head="{
        'meta[charset]': {charset: 'utf-8'},
    }"
/>

<!-- Results in:
<head>
    <meta charset="utf-8">
</head>
<body id="aPageId">
<h1 data-foo="bar"></h1>
-->

If you want to remove a previously defined attribute from an element, you can set it to null as in the example below:

<vue-headful :title="null"/>
<!-- Results in:
<title></title>
<meta itemprop="name">
<meta property="og:title">
<meta name="twitter:title">
-->

Note that neither Headful nor vue-headful add missing HTML elements, they only add attribute values. So it is important that you add everything that you want to have populated in your HTML first. For example, to specify the title and description you have to prepare the HTML as follows.

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta itemprop="name">
    <meta property="og:title">
    <meta name="twitter:title">
    <meta name="description"/>
    <meta itemprop="description">
    <meta property="og:description">
    <meta name="twitter:description">
</head>
<body>
<!-- ... -->
</body>
</html>

vue-headful also supports dynamic properties (e.g. v-bind:title="variableName" or :title="variableName") and adds watchers to everything. That means you can also set head properties asynchronously, for example after an API request.

<template>
    <vue-headful
        :title="title"
        description="Static description"
    />
</template>

<script>
    export default {
        data() {
            return {
                title: 'Dynamic title',
            };
        },
        mounted() {
            // dummy async operation to show watcher on properties
            setTimeout(() => {
                this.title = 'Dynamic async title';
            }, 3000);
        },
    };
</script>

Also see the non-complete list of meta tags and other head properties you can define using vue-headful:

  • <html lang>
  • <title>
  • <meta name="description">
  • <meta itemprop="description">
  • <meta property="og:description">
  • <meta name="twitter:description">
  • <meta name="keywords">
  • <meta itemprop="image">
  • <meta property="og:image">
  • <meta name="twitter:image">
  • <meta property="og:locale">
  • <link rel="canonical">
  • <meta property="og:url">
  • <meta name="twitter:url">

For more information on everything you can put into <head>, have a look at https://gethead.info/.

Compatibility

vue-headful works with every current and most reasonably old web browsers. If you need to support older browsers including Internet Explorer, have a look at Headful: Compatibility.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].