An aurelia plugin handling meta tags
A plugin on top of aurelia-router
to handle meta tags of your application, both automatically and manually.
Install the plugin
yarn install aurelia-meta
Make Aurelia aware of your application
aurelia.use.plugin('aurelia-meta');
PLATFORM.moduleName
if you use webpack
config.map([
{
route: '',
name: 'home',
moduleId: PLATFORM.moduleName('./routes/home'),
nav: true,
title: 'Home',
meta: [
{
name: 'home', content: 'This is a Home page'
},
{
property: 'og:title' , content:'Home'
},
{
property: 'og:description' , content:'Aurelia meta is a plugin for Aurelia'
}
]
},
...
]);
import { autoinject } from "aurelia-framework";
import { AureliaMetaService } from "aurelia-meta";
@autoinject()
export class HomeRouteComponent{
message: string = "Hello world!";
constructor(private aureliaMetaService: AureliaMetaService) { }
activate() {
this.aureliaMetaService.addTag({
name: 'author' , content:'Saeed Ganji'
});
}
deactivate() {
this.aureliaMetaService.removeTag({
name: 'author' , content:'Saeed Ganji'
})
}
}
clone
this repository and run au build-plugin
npm start