2023-09-11 07:14:56 +00:00

42 lines
1.4 KiB
JavaScript
Vendored

import { slugify } from 'transliteration';
export default {
methods: {
// CDN paths
clientCDNPath(client, location) {
return "https://cdn.motorradhandel.ch/media/clients/" + client + '/' + location;
},
adCDNPath(client, location) {
return this.clientCDNPath(client, location) + '/ads/';
},
marktplatzCDNPath(client, location) {
return this.clientCDNPath(client, location) + '/marktplatz/';
},
brandLogos(logo) {
return "https://cdn.motorradhandel.ch/media/marken/images/" + logo;
},
// Slug creations
adSlug(locale, brandName, modelName, id) {
return '/' + locale + '/d/' + this.safeString(brandName) + '/' + this.safeString(modelName) + '/' + id;
},
rentalSlug(locale, brandName, modelName, id) {
return '/' + locale + '/m/' + this.safeString(brandName) + '/' + this.safeString(modelName) + '/' + id;
},
clientSlug(locale, clientName, id) {
return '/' + locale + '/h/' + this.safeString(clientName) + '/' + id;
},
marktplatzSlug(locale, art, title, id) {
return '/' + locale + '/mp/' + this.safeString(art) + '/' + this.safeString(title) + '/' + id;
},
bikesorySlug(locale, title, brand, model, id) {
return '/' + locale + '/stories/' + this.safeString(title) + '/' + this.safeString(brand) + '/' + this.safeString(model) + '/' + id;
},
safeString(str) {
return slugify(str).replace(/[-\s]+/g, '-');
},
}
};