Remove duplicate metadata tags

Some metadata was being set twice, because property and name
attributes for Twitter items were both being set.
This commit is contained in:
hunicus 2024-03-10 09:17:32 +09:00
parent 1b92c62353
commit d1c12f9f6e
No known key found for this signature in database
GPG Key ID: 24837C51B6D81FD9
2 changed files with 4 additions and 4 deletions

View File

@ -53,7 +53,7 @@ export class OpenGraphService {
const lang = this.LanguageService.getLanguage();
const ogImageUrl = `${window.location.protocol}//${window.location.host}/render/${lang}/preview${this.router.url}`;
this.metaService.updateTag({ property: 'og:image', content: ogImageUrl });
this.metaService.updateTag({ property: 'twitter:image:src', content: ogImageUrl });
this.metaService.updateTag({ name: 'twitter:image', content: ogImageUrl });
this.metaService.updateTag({ property: 'og:image:type', content: 'image/png' });
this.metaService.updateTag({ property: 'og:image:width', content: '1200' });
this.metaService.updateTag({ property: 'og:image:height', content: '600' });
@ -61,7 +61,7 @@ export class OpenGraphService {
clearOgImage() {
this.metaService.updateTag({ property: 'og:image', content: this.defaultImageUrl });
this.metaService.updateTag({ property: 'twitter:image:src', content: this.defaultImageUrl });
this.metaService.updateTag({ name: 'twitter:image', content: this.defaultImageUrl });
this.metaService.updateTag({ property: 'og:image:type', content: 'image/png' });
this.metaService.updateTag({ property: 'og:image:width', content: '1000' });
this.metaService.updateTag({ property: 'og:image:height', content: '500' });

View File

@ -39,14 +39,14 @@ export class SeoService {
setTitle(newTitle: string): void {
this.titleService.setTitle(newTitle + ' - ' + this.getTitle());
this.metaService.updateTag({ property: 'og:title', content: newTitle});
this.metaService.updateTag({ property: 'twitter:title', content: newTitle});
this.metaService.updateTag({ name: 'twitter:title', content: newTitle});
this.metaService.updateTag({ property: 'og:meta:ready', content: 'ready'});
}
resetTitle(): void {
this.titleService.setTitle(this.getTitle());
this.metaService.updateTag({ property: 'og:title', content: this.getTitle()});
this.metaService.updateTag({ property: 'twitter:title', content: this.getTitle()});
this.metaService.updateTag({ name: 'twitter:title', content: this.getTitle()});
this.metaService.updateTag({ property: 'og:meta:ready', content: 'ready'});
}