@lenne.tech/ng-base 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/lenne.tech-ng-base-src-lib-base.umd.js +71 -14
- package/bundles/lenne.tech-ng-base-src-lib-base.umd.js.map +1 -1
- package/bundles/lenne.tech-ng-base.umd.js +71 -14
- package/bundles/lenne.tech-ng-base.umd.js.map +1 -1
- package/esm2015/lib/base/factories/apollo-options.factory.js +3 -2
- package/esm2015/lib/base/services/seo.service.js +70 -14
- package/esm2015/src/lib/base/factories/apollo-options.factory.js +3 -2
- package/esm2015/src/lib/base/services/seo.service.js +70 -14
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js +71 -14
- package/fesm2015/lenne.tech-ng-base-src-lib-base.js.map +1 -1
- package/fesm2015/lenne.tech-ng-base.js +71 -14
- package/fesm2015/lenne.tech-ng-base.js.map +1 -1
- package/lib/base/services/seo.service.d.ts +36 -3
- package/package.json +1 -1
- package/src/lib/base/lenne.tech-ng-base-src-lib-base.metadata.json +1 -1
- package/src/lib/base/services/seo.service.d.ts +36 -3
|
@@ -212,8 +212,9 @@ AuthService.ctorParameters = () => [
|
|
|
212
212
|
*/
|
|
213
213
|
function apolloOptionsFactory(baseModuleConfig, httpLink, authService) {
|
|
214
214
|
const links = [];
|
|
215
|
+
const defaultUrl = 'api.' + window.location.href + '/graphql';
|
|
215
216
|
const http = httpLink.create({
|
|
216
|
-
uri: baseModuleConfig.apiUrl,
|
|
217
|
+
uri: baseModuleConfig.apiUrl ? baseModuleConfig.apiUrl : 'https://' + defaultUrl,
|
|
217
218
|
});
|
|
218
219
|
const authMiddleware = new ApolloLink((operation, forward) => {
|
|
219
220
|
const headers = {};
|
|
@@ -2310,23 +2311,79 @@ class SEOService {
|
|
|
2310
2311
|
this.titleService = titleService;
|
|
2311
2312
|
this.metaTagService = metaTagService;
|
|
2312
2313
|
}
|
|
2313
|
-
initPageForSEO(
|
|
2314
|
-
this.
|
|
2315
|
-
this.
|
|
2316
|
-
|
|
2317
|
-
|
|
2314
|
+
initPageForSEO(input) {
|
|
2315
|
+
this.setGeneralData(input);
|
|
2316
|
+
this.setTwitterData(input);
|
|
2317
|
+
this.setTwitterData(input);
|
|
2318
|
+
this.setFacebookData(input);
|
|
2319
|
+
if (input.keywords) {
|
|
2320
|
+
this.setPageKeywords(input.keywords);
|
|
2318
2321
|
}
|
|
2319
2322
|
}
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2323
|
+
/**
|
|
2324
|
+
* Set general metadata
|
|
2325
|
+
*
|
|
2326
|
+
* @param data
|
|
2327
|
+
* @private
|
|
2328
|
+
*/
|
|
2329
|
+
setGeneralData(data) {
|
|
2330
|
+
this.titleService.setTitle(data.title);
|
|
2331
|
+
this.metaTagService.updateTag({ name: 'description', content: data.description });
|
|
2324
2332
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2333
|
+
/**
|
|
2334
|
+
* Set metadata for twitter
|
|
2335
|
+
*
|
|
2336
|
+
* @param data
|
|
2337
|
+
* @private
|
|
2338
|
+
*/
|
|
2339
|
+
setTwitterData(data) {
|
|
2340
|
+
this.metaTagService.updateTag({ name: 'twitter:title', content: data.title });
|
|
2341
|
+
this.metaTagService.updateTag({ name: 'twitter:description', content: data.description });
|
|
2342
|
+
this.metaTagService.updateTag({
|
|
2343
|
+
property: 'twitter:url',
|
|
2344
|
+
content: data.url ? data.url : window.location.href,
|
|
2345
|
+
});
|
|
2346
|
+
if (data.image) {
|
|
2347
|
+
this.metaTagService.updateTag({
|
|
2348
|
+
property: 'twitter:image',
|
|
2349
|
+
content: data.image,
|
|
2350
|
+
});
|
|
2351
|
+
this.metaTagService.updateTag({
|
|
2352
|
+
property: 'twitter:card',
|
|
2353
|
+
content: 'summary_large_image',
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2329
2356
|
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Set metadata for facebook
|
|
2359
|
+
*
|
|
2360
|
+
* @param data
|
|
2361
|
+
* @private
|
|
2362
|
+
*/
|
|
2363
|
+
setFacebookData(data) {
|
|
2364
|
+
this.metaTagService.updateTag({ property: 'og:title', content: data.title });
|
|
2365
|
+
this.metaTagService.updateTag({ property: 'og:description', content: data.description });
|
|
2366
|
+
this.metaTagService.updateTag({
|
|
2367
|
+
property: 'og:type',
|
|
2368
|
+
content: 'website',
|
|
2369
|
+
});
|
|
2370
|
+
this.metaTagService.updateTag({
|
|
2371
|
+
property: 'og:url',
|
|
2372
|
+
content: data.url ? data.url : window.location.href,
|
|
2373
|
+
});
|
|
2374
|
+
if (data.image) {
|
|
2375
|
+
this.metaTagService.updateTag({
|
|
2376
|
+
property: 'og:image',
|
|
2377
|
+
content: data.image,
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Set page keywords
|
|
2383
|
+
*
|
|
2384
|
+
* @param keywords
|
|
2385
|
+
* @private
|
|
2386
|
+
*/
|
|
2330
2387
|
setPageKeywords(keywords) {
|
|
2331
2388
|
this.metaTagService.updateTag({ name: 'keywords', content: keywords });
|
|
2332
2389
|
}
|