fix(core): update
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
import * as plugins from '../websetup.plugins';
|
||||
|
||||
export interface IMetaObject {
|
||||
title: string;
|
||||
description: string;
|
||||
canonicalDomain?: string;
|
||||
ldCompany?: plugins.tsclass.business.ICompany;
|
||||
ldProduct?: any;
|
||||
}
|
||||
|
||||
export const setupMetaInformation = async (metaObjectArg: IMetaObject) => {
|
||||
@ -10,6 +14,10 @@ export const setupMetaInformation = async (metaObjectArg: IMetaObject) => {
|
||||
addMetaTag('google', 'notranslate');
|
||||
addMetaTag('revisited-after', '1 days');
|
||||
metaObjectArg.canonicalDomain ? addLinkTag('canonical', metaObjectArg.canonicalDomain) : null;
|
||||
|
||||
if (metaObjectArg.ldCompany) {
|
||||
addCompanyJsonLD(metaObjectArg.ldCompany)
|
||||
}
|
||||
};
|
||||
|
||||
const addMetaTag = async (linkNameArg: string, contentArg: string) => {
|
||||
@ -27,3 +35,35 @@ const addLinkTag = async (relArg, hrefArg) => {
|
||||
link.setAttribute('href', hrefArg);
|
||||
document.head.appendChild(link);
|
||||
};
|
||||
|
||||
const addCompanyJsonLD = async (companyDataArg: plugins.tsclass.business.ICompany) => {
|
||||
const companyLd = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Corporation",
|
||||
"name": companyDataArg.name,
|
||||
"alternateName": companyDataArg.name.replace(' GmbH', ''),
|
||||
"url": companyDataArg.contact.website,
|
||||
"logo": companyDataArg.contact.logoUrl,
|
||||
"contactPoint": {
|
||||
"@type": "ContactPoint",
|
||||
"telephone": companyDataArg.contact.phone,
|
||||
"contactType": "customer service",
|
||||
"areaServed": "DE",
|
||||
"availableLanguage": ["en","German"]
|
||||
},
|
||||
"sameAs": []
|
||||
};
|
||||
|
||||
if (companyDataArg.contact.facebookUrl) {
|
||||
companyLd.sameAs.push(companyDataArg.contact.facebookUrl);
|
||||
}
|
||||
|
||||
if (companyDataArg.contact.twitterUrl) {
|
||||
companyLd.sameAs.push(companyDataArg.contact.twitterUrl);
|
||||
}
|
||||
|
||||
const jsonLdElement = document.createElement('script');
|
||||
jsonLdElement.type = 'application/ld+json';
|
||||
jsonLdElement.text = JSON.stringify(companyLd);
|
||||
document.querySelector('head').appendChild(jsonLdElement);
|
||||
};
|
||||
|
@ -1,2 +1,5 @@
|
||||
const removeme = {};
|
||||
export { removeme };
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
export {
|
||||
tsclass
|
||||
};
|
||||
|
Reference in New Issue
Block a user