Have you looked into using the settings property on a route itself? This is an object where you can specify data for a particular route, I personally use it to specify icons for menus generated using Aurelia, but it can be used for anything.
configureRouter(config, router) {
config.title = 'Test Route';
config.map([
{
route: ['', 'welcome'],
name: 'welcome',
moduleId: './welcome',
title: 'Welcome',
settings: {
image: '/images/someimage.png',
description: 'This is my social share description for this route.'
}
}
]);
this.router = router;
}
Now to access the settings object, inside of your route viewmodel you will define a callback method called activate
this method receives 3 parameters. The first one is any route parameters and the second is the route object itself for the current route.
export class MyViewModel {
image = null;
description = null;
activate(params, routeMap) {
if (routeMap.settings) {
this.image = routeMap.settings.image;
this.description = routeMap.settings.description;
}
}
}
Now inside of your view template HTML, you can do this:
${image}
and ${description}
to get the above values that you set inside of your viewmodel taken directly from the current route.
og
"tags" Facebook won't read them. – Underhung