All Projects → AvraamMavridis → Angular Metatags

AvraamMavridis / Angular Metatags

Module for providing dynamic Meta Tags to Angular routes

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Metatags

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 (+59.68%)
Mutual labels:  seo, meta-tags
Meta Tags
Search Engine Optimization (SEO) for Ruby on Rails applications.
Stars: ✭ 2,464 (+3874.19%)
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 (+112.9%)
Mutual labels:  seo, meta-tags
Head
A simple guide to HTML <head> elements
Stars: ✭ 28,892 (+46500%)
Mutual labels:  seo, meta-tags
Awesome-meta-tags
📙 Awesome collection of meta tags
Stars: ✭ 18 (-70.97%)
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 (+59.68%)
Mutual labels:  seo, meta-tags
Seotools
SEO Tools for Laravel
Stars: ✭ 2,406 (+3780.65%)
Mutual labels:  seo, meta-tags
Ngmeta
Dynamic meta tags in your AngularJS single page application
Stars: ✭ 152 (+145.16%)
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 (+314.52%)
Mutual labels:  seo, meta-tags
Laravelmetatags
The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project
Stars: ✭ 226 (+264.52%)
Mutual labels:  seo, meta-tags
Vue Headful
Set document title and meta tags with Vue.js
Stars: ✭ 229 (+269.35%)
Mutual labels:  seo, meta-tags
laravel-assets
Laravel Assets manager
Stars: ✭ 13 (-79.03%)
Mutual labels:  seo, 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 (-61.29%)
Mutual labels:  seo, meta-tags
Ngx Meta
Dynamic page title & meta tags utility for Angular (w/server-side rendering)
Stars: ✭ 331 (+433.87%)
Mutual labels:  seo, meta-tags
Wjsp
WEBPACK + JSP 构建多页应用
Stars: ✭ 48 (-22.58%)
Mutual labels:  seo
Awesome Seo
Google SEO研究及流量变现
Stars: ✭ 942 (+1419.35%)
Mutual labels:  seo
Webedge
Bringing Edge to your Web Performance ✨💥
Stars: ✭ 21 (-66.13%)
Mutual labels:  seo
Hugo Handbook
Building static website with hugo - https://jimmysong.io/hugo-handbook
Stars: ✭ 58 (-6.45%)
Mutual labels:  seo
Seo Bundle
A SEO Solution for duplicate contents, page titles, etc.
Stars: ✭ 45 (-27.42%)
Mutual labels:  seo
Librecms
Free Open Source Content Management System, based on PHP, Bootstrap and jQuery.
Stars: ✭ 12 (-80.65%)
Mutual labels:  seo

Angular MetaTags module

Module to dynamically provide metatags based on the path. After this PR it supports both ngRoute and ui-router (only simple states).

How to use it

Include angular-metatags.js or angular-metatags.min.js to your html file before your app script and after the angular's core script

<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="scripts/angular-metatags.js"></script>
<script src="scripts/mainApp.js"></script>

Include the module in your app

var myApp = angular.module('myApp', ['ngRoute','metatags']);

Inject the MetaTagsProvider in the config and define your meta tags

myApp.config(['$routeProvider','MetaTagsProvider', function($routeProvider, MetaTagsProvider) {

        ...
        ...
        
        MetaTagsProvider
          .when('/', {
            title: 'Great',
            description: 'Cool'
            fb_title: 'My title'
            fb_site_name: 'My site name' 
            fb_url: 'www.blablabla.blabla' 
            fb_description: 'Cool website'
            fb_type: 'Facebook type'
            fb_image: 'an_image.jpg' 
          })
          .when('/page1/:parameter1/:parameter2',{
            title: 'Page 1 :something',
            description: function(parameter1, parameter2){
                return 'COOOOOOOL' + parameter1 + " Super " + parameter2;
            }
            robots: 'index, follow'
            keywords: 'some cool keywords'
          })
          .when('/page2/:parameter1',{
            title: 'Page 2 of :parameter1',
            description: 'Another great page'
          })
          .otherwise({
            title: 'otherwise',
            description: 'Another great page'
          })
    }]);

when Accepts a string with the path and an object with metatags when(path,metatags) The path can contain parameters, each parameter should start with : . Each attribute of the metatags object can be a string or a function that returns a string. The string can contain a parameter that will be replaced. If the path contain parameters and an attribute of the metatags object is a function the parameters are passed to that function.

Example

If we define a route like this

.when('/page1/:parameter1/:parameter2',{
    title: 'Books of :parameter1 by :parameter2',
    description: function(parameter1, parameter2){
      return 'We have great books of ' + parameter1.toUpperCase() + ' by the amazing :parameter2';
    },
    robots: 'index, follow',
    keywords: function(parameter1){
      var keywords = ['history', 'art', 'music']
      keywords.push(parameter1);
      return keywords.join(' ');
    }
})

and we visit the path /page1/geography/nationalgeographic We will have the following object of metatags:

$rootScope.metatags =  { 
  title: "Books of geography by nationalgeographic", 
  description: "We have great books of GEOGRAPHY by the amazing nationalgeographic", 
  robots: "index, follow", 
  keywords: "history art music geography" 
}

Initialize the provider on your application run

myApp.run(function(MetaTags){
    MetaTags.initialize();
});

Include the metatags in your html

You can use the metatags in our html like this:

  <title>{{ metatags.title }}</title>
  <meta name="description" content="{{ metatags.description }}" >
  <meta name="robots" content="{{ metatags.robots }}" >
  <meta name="keywords" content="{{ metatags.keywords }}" >
  <!-- Facebook related metatags -->
  <meta property="fb:app_id"          content="{{ metatags.fb_app_id }}" > 
  <meta property="og:url"             content="{{ metatags.fb_url }}"  > 
  <meta property="og:title"           content="{{ metatags.fb_title }}" > 
  <meta property="og:image"           content="{{ metatags.fb_image }}"  > 
  <meta property="og:description"     content="{{ metatags.fb_description }}"  >
  <meta property="og:site_name"       content="{{ metatags.fb_site_name }}" >
  <meta property="og:type"            content="{{ metatags.fb_type }}" >

Angular and SEO

Until the search engine bots will be able to execute javascript properly you will have to use a tool like prerender.io or brombone to serve prerendered pages when a bot visit your site. You can read more for the topic on the following articles:

-Weluse.de - Angular & SEO finally a piece of cake

-Builtvisible.com - The Basics of JavaScript Framework SEO in AngularJS

-Yearofmoo.com - AngularJS and SEO

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].