privacy.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Component, OnInit, inject } from '@angular/core';
  2. import { PlatformLocation } from '@angular/common';
  3. import { Meta, Title } from '@angular/platform-browser';
  4. import { TranslateService, _, TranslatePipe } from '@ngx-translate/core';
  5. @Component({
  6. selector: 'app-profile', templateUrl: './privacy.html', styleUrl: './privacy.scss',
  7. standalone: true, imports: [TranslatePipe]
  8. })
  9. export class Privacy {
  10. private translate = inject(TranslateService)
  11. constructor(
  12. private titleService: Title, private metaService: Meta,
  13. private platformLocation: PlatformLocation
  14. ){
  15. // Set meta tags
  16. const url
  17. = this.platformLocation.protocol + "//" + this.platformLocation.hostname + "/privacy";
  18. this.metaService.addTag({ property: 'canonical', content: url });
  19. this.metaService.addTag({ property: 'og:url', content: url });
  20. this.metaService.addTag({ property: 'og:image', content: url + '/img/logo/leather.png' });
  21. this.translate.get(_('PRIVACY.TITLE')).subscribe((resSite: string) => {
  22. this.translate.get(_('PROFILE.TITLE')).subscribe((resProfile: string) => {
  23. this.titleService.setTitle(resProfile + " - " + resSite);
  24. this.metaService.addTag({
  25. property: 'og:title', content: resProfile + " - " + resSite
  26. });
  27. this.metaService.addTag({
  28. property: 'title', content: resProfile + " - " + resSite
  29. });
  30. });
  31. });
  32. this.translate.get(_('PRIVACY.DESCRIPTION')).subscribe((res: string) => {
  33. this.metaService.addTag({ property: 'og:description', content: res});
  34. this.metaService.addTag({ property: 'description', content: res});
  35. });
  36. }
  37. }